All Posts

Leetcode 31: Next Permutation

You are given an array of integers ’nums’. Find the next lexicographically greater permutation of the array. If no such permutation exists, return the smallest possible arrangement (sorted in ascending order). The result must be computed in place with no extra space.

Leetcode 33: Search in Rotated Sorted Array

You are given a sorted array ’nums’ which may have been rotated at an unknown pivot. Your task is to search for a target value in this rotated array. Return the index of the target if found, or -1 if not found. The solution must have a runtime complexity of O(log n).

Leetcode 34: Find First and Last Position of Element in Sorted Array

Given a sorted array ’nums’ in non-decreasing order, find the starting and ending index of a target value. If the target is not found, return [-1, -1]. Your solution must run in O(log n) time complexity.

Leetcode 35: Search Insert Position

Given a sorted array of distinct integers and a target value, return the index of the target if it is present. If the target is not in the array, return the index where it should be inserted to maintain the sorted order.

Leetcode 36: Valid Sudoku

Determine if a 9x9 Sudoku board is valid. A valid Sudoku board follows three rules: Each row, column, and 3x3 sub-box must contain the digits 1-9 without repetition. Only the filled cells need to be validated.

Leetcode 39: Combination Sum

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 can be chosen from candidates an unlimited number of times. Two combinations are unique if the frequency of at least one of the chosen numbers is different.