All Posts

Leetcode 45: Jump Game II

You are given a 0-indexed array ’nums’ where each element represents the maximum length you can jump forward from that index. You are initially positioned at nums[0], and you need to reach the last index. Return the minimum number of jumps needed to reach the last index.

Leetcode 46: Permutations

Given a list of distinct integers, generate and return all possible permutations of the elements. The result can be returned in any order.

Leetcode 47: Permutations II

Given a collection of numbers that may contain duplicates, generate and return all possible unique permutations of the numbers.

Leetcode 48: Rotate Image

Given an n x n 2D matrix representing an image, rotate the image by 90 degrees clockwise. The rotation should be done in-place, meaning you cannot allocate another 2D matrix.

Leetcode 49: Group Anagrams

You are given an array of strings. Group the strings that are anagrams of each other together and return them as a list of lists. An anagram is a word or phrase formed by rearranging the letters of another word or phrase.

Leetcode 50: Pow(x, n)

You are given a number x and an integer n. Your task is to compute x raised to the power n (i.e., x^n). Handle cases where the exponent is negative by returning the reciprocal of the result.