# Blogs Hub

### by AskGif | Oct 28, 2020 | Category :coding

#### Jump Game - Array - Medium - LeetCode

Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maximum jump length at that position. Determine if you are able to reach the last index. &nbsp; Example 1: Input: num

### by AskGif | Oct 27, 2020 | Category :coding

#### Spiral Matrix - Array - Medium - LeetCode

Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order. Example 1: Input:<br />[<br />&nbsp;[ 1, 2, 3 ],<br />&nbsp;[ 4, 5, 6 ],<br />&nbsp;[ 7, 8, 9 ]<br />]<br />Output: [1,2,3,6,9,8,7,4,5]<br />Example 2: Input:<br />[<br />

### by AskGif | Oct 26, 2020 | Category :coding

#### Rotate Image - Array - Medium - LeetCode

You are given an n x n 2D matrix representing an image, rotate the image by 90 degrees (clockwise). You have to rotate the image in-place, which means you have to modify the input 2D matrix directly. DO NOT allocate another 2D matrix and do the rotation. &nbsp; Example 1:

### by AskGif | Oct 25, 2020 | Category :coding

#### Combination Sum II - Array - Medium - LeetCode

Given a collection of candidate numbers (candidates) and a target number (target), find all unique combinations in candidates where the candidate numbers sum to target. Each number in candidates may only be used once in the combination. Note: The solution set must not contain duplic

### by AskGif | Oct 25, 2020 | Category :coding

#### Combination Sum - Array - Medium - LeetCode

Given an array of distinct integers candidates and a target integer target, return a list of all unique combinations of candidates where the chosen numbers sum to target. You may return the combinations in any order. The same number may be chosen from candidates an unlimited number of time

### by AskGif | Oct 25, 2020 | Category :coding

#### Find First and Last Position of Element in Sorted Array - Array - Medium - LeetCode

Given an array of integers nums sorted in ascending order, find the starting and ending position of a given target value. If the target is not found in the array, return [-1, -1]. Follow up: Could you write an algorithm with O(log n) runtime complexity? &nbsp; Example

### by AskGif | Oct 24, 2020 | Category :coding

#### Search in Rotated Sorted Array - Array - Medium - LeetCode

You are given an integer array nums sorted in ascending order, and an integer target. Suppose that nums is rotated at some pivot unknown to you beforehand (i.e., [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2]). If target is found in the array return its index, otherwise, return -1.</p

### by AskGif | Oct 24, 2020 | Category :coding

#### Next Permutation - Array - Medium - LeetCode

Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers. If such an arrangement is not possible, it must rearrange it as the lowest possible order (i.e., sorted in ascending order). The replacement must be in place and use

### by AskGif | Oct 24, 2020 | Category :coding

#### 4Sum - Array - Medium - LeetCode

Given an array nums of n integers and an integer target, are there elements a, b, c, and d in nums such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target. Notice that the solution set must not contain duplicate quadruplets. &nbsp;</p

### by AskGif | Oct 24, 2020 | Category :coding

#### New Year Chaos - Array - Medium - HackerRank

It's New Year's Day and everyone's in line for the Wonderland rollercoaster ride! There are a number of people queued up, and each person wears a sticker indicating their initial position in the queue. Initial positions increment by &nbsp;from &nbsp;at the front of the line to &nbsp;at the back.<

### by AskGif | Oct 23, 2020 | Category :coding

#### 3Sum Closest - Array - Medium - LeetCode

Given an array nums of n integers and an integer target, find three integers in nums such that the sum is closest to target. Return the sum of the three integers. You may assume that each input would have exactly one solution. &nbsp; Example 1: Input: nums = [-1,2,1,-4], targ