Tag: array

  • Rotate array [LC150]

    Hello friends, Today we’re going to discuss and solve another Leetcode DSA problem about rotating array. link- https://leetcode.com/problems/rotate-array/description/ Given an integer array nums, rotate the array to the right by k steps, where k is non-negative. Example 1: Input: nums = [1,2,3,4,5,6,7], k = 3, Output: [5,6,7,1,2,3,4]Explanation:rotate 1 steps to the right: [7,1,2,3,4,5,6]rotate 2 steps…

  • Remove duplicates from-sorted array-2 [LC150]

    Hello friends, Today we’re going to discuss another Leetcode DSA problem about removing duplicates from-sorted array. link- https://leetcode.com/problems/remove-duplicates-from-sorted-array-ii/description/ Given an integer array nums sorted in non-decreasing order, remove some duplicates in-place such that each unique element appears at most twice. The relative order of the elements should be kept the same. To change the length of the array in some languages, you need to…

  • Remove array element in-place [LC150]

    Hello friends, Today we’re going to discuss another Leetcode DSA problem about removing array element in-place. link- https://leetcode.com/problems/remove-element/description Given an integer array nums and an integer val, remove all instances of val from nums in place. The order of elements can be changed. Return the count of elements in nums that are not equal to…

  • Merge Sorted Array [LC150]

    Hello friends, Today we are going to solve another leetcode problem about merging sorred array. Link- https://leetcode.com/problems/merge-sorted-array/description/ You have two integer arrays, nums1 and nums2, which are sorted from smallest to largest. You also have two numbers, m and n, which show how many elements are in nums1 and nums2 respectively. Your goal is to…