Leetcode

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 787 Cheapest Flights Within K Stops Java Solution

There are n cities connected by m flights. Each flight starts from city u and arrives at v with a price w. Now…

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

Leetcode 24 Swap Nodes in Pairs Java Solution

Given a linked list, swap every two adjacent nodes and return its head. You may not modify the values in the list's nodes,…

2 years ago

Leetcode 21 Merge Two Sorted Lists Java Solution

Merge two sorted linked lists and return it as a new sorted list. The new list should be made by splicing together…

2 years ago

Leetcode 20 Valid Parentheses Java Solution

Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. An input string is valid if:…

2 years ago

Leetcode 19 Remove Nth Node From End of List Java Solution

Given a linked list, remove the n-th node from the end of list and return its head. Example: Given linked list:…

2 years ago

This website uses cookies.