Skip to content

hamzaiftkhar/Leetcode-Problems

Repository files navigation

Leetcode-Problems

Welcome to the Daily Coding Problems repository! In this repository, you will find a collection of daily coding problems to challenge and improve your programming skills.

  • Problem 1- Two Sum Problem - Given an array of integers and a target, find two numbers in the array that add up to the target.

  • Problem 2- Remove Duplicates from Sorted Array - Given an integer array nums sorted in non-decreasing order, remove the duplicates in-place such that each unique element appears only once. The relative order of the elements should be kept the same. Then return the number of unique elements in nums.

  • Problem 3- Remove Element - Given an integer array nums and an integer val, remove all occurrences of val in nums in-place. The order of the elements may be changed. Then return the number of elements in nums which are not equal to val.

  • Problem 4- Search Insert Position - Given a sorted array of distinct integers and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order. You must write an algorithm with O(log n) runtime complexity.

  • Problem 5- Plus One - Given a non-empty array of decimal digits representing a non-negative integer, increment one to the integer. The digits are stored such that the most significant digit is at the head of the list, and each element in the array contains a single digit. You must write an algorithm with O(n) runtime complexity.

  • Problem 6- Pascal's Triangle - Given an integer numRows, return the first numRows of Pascal's triangle. In Pascal's triangle, each number is the sum of the two numbers directly above it as shown.

  • Problem 7- Merge Two Sorted Arrays - Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array. The number of elements initialized in nums1 and nums2 are m and n respectively. You must write an algorithm with O(m + n) runtime complexity.

  • Problem 8- Single Number - Given a non-empty array of integers nums, every element appears twice except for one. Find that single one. You must write an algorithm with O(n) runtime complexity and O(1) extra space complexity.

  • Problem 9- Majority Element - Given an array nums of size n, return the majority element. The majority element is the element that appears more than ⌊n / 2⌋ times. You may assume that the majority element always exists in the array. You must write an algorithm with O(n) runtime complexity and O(1) extra space complexity.

  • Problem 10- Pascal's Triangle II - Given an integer rowIndex, return the rowIndex-th (0-indexed) row of Pascal's triangle. In Pascal's triangle, each number is the sum of the two numbers directly above it .

  • Problem 11- Summary Ranges - You are given a sorted unique integer array nums. Return the smallest sorted list of ranges that cover all the numbers in the array exactly. That is, each element of nums is covered by exactly one of the ranges, and there is no integer x such that x is in one of the ranges but not in nums.

  • Problem 12- Missing Number in Array - Given an array nums containing n distinct numbers in the range [0, n], return the only number in the range that is missing from the array.

  • Problem 13- Move Zeros - Given an integer array nums, move all 0's to the end of it while maintaining the relative order of the non-zero elements. You must do this in-place without making a copy of the array.

  • Problem 14- Range Sum Query - Immutable - Given an integer array nums, handle multiple queries of the following type: Calculate the sum of the elements of nums between indices left and right.

About

Daily Leetcode Problems Solution

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages