Algorithms

Leetcode 49 Group Anagrams Java Solution

Given an array of strings, group anagrams together. Example: Input: ["eat", "tea", "tan", "ate", "nat", "bat"], Output: [ ["ate","eat","tea"], ["nat","tan"],…

2 years ago

Leetcode 46 Permutations Java Solution

Given a collection of distinct integers, return all possible permutations. Example: Input: [1,2,3] Output: [ [1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], [3,2,1] ]…

2 years ago

Leetcode 41 First Missing Positive Java Solution

Given an unsorted integer array, find the smallest missing positive integer. Example 1: Input: [1,2,0] Output: 3 Example 2: Input: [3,4,-1,1]…

2 years ago

Leetcode 37 Sudoku Solver Java Solution

Write a program to solve a Sudoku puzzle by filling the empty cells. A sudoku solution must satisfy all of the following rules:…

2 years ago

Leetcode 36 Valid Sudoku Java Solution

Determine if a 9x9 Sudoku board is valid. Only the filled cells need to be validated according to the following rules: Each row must contain…

2 years ago

Leetcode 35 Search Insert Position Java Position

Given a sorted array and a target value, return the index if the target is found. If not, return the…

2 years ago

Leetcode 33 Search in Rotated Sorted Array Java Solution

Suppose an array sorted in ascending order 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]). You are…

2 years ago

Leetcode 31 Next Permutation Java Solution

Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers. If such arrangement is not possible, it…

2 years ago

Leetcode 27 Remove Element Java Solution

Given an array nums and a value val, remove all instances of that value in-place and return the new length. Do not allocate extra space…

2 years ago

Leetcode 26 Remove Duplicates from Sorted Array Java Solution

Given a sorted array nums, remove the duplicates in-place such that each element appear only once and return the new length. Do not allocate extra…

2 years ago

This website uses cookies.