GeetCode Hub

Hard

Reverse Nodes in k-Group

25. Reverse Nodes in k-Group

Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. k is a positive integer and is less than or equal to the length of the linked list. If the number of nodes is not a multiple of k then left-out nodes, in the end, sh

read more...

Easy

Remove Duplicates from Sorted Array

26. Remove Duplicates from Sorted Array

Given an integer array nums sorted in non-decreasing order, remove the duplicates in-place such that each unique element appears only once.

read more...

Easy

Remove Element

27. Remove Element

Given an integer array nums and an integer val, remove all occurrences of val in nums in-place. The relative order of the elements may

read more...

Easy

Implement strStr()

28. Implement strStr()

Implement strStr(). Return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack. Clarification:<

read more...

Medium

Divide Two Integers

29. Divide Two Integers

Given two integers dividend and divisor, divide two integers without using multiplication, division, and mod operator. Return the quotient after dividing dividend by divisor. The integer division should truncate toward zero, which

read more...

Hard

Substring with Concatenation of All Words

30. Substring with Concatenation of All Words

You are given a string s and an array of strings words of the same length. Return&nbsp;all starting indices of substring(s) in s&nbsp;that is a concatenation of each word in words exactly once, in any or

read more...

Medium

Next Permutation

31. Next Permutation

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

read more...

Hard

Longest Valid Parentheses

32. Longest Valid Parentheses

Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring. &nbsp; Example 1: Input: s = "(()" Output: 2 Explanation

read more...

Medium

Search in Rotated Sorted Array

33. Search in Rotated Sorted Array

There is an integer array nums sorted in ascending order (with distinct values). Prior to being passed to your function, nums is rotated at an unknown pivot index k (0 &lt;= k &lt; nums.length) such that

read more...

Medium

Find First and Last Position of Element in Sorted Array

34. Find First and Last Position of Element in Sorted Array

Given an array of integers nums sorted in ascending order, find the starting and ending position of a given target value. If target is not found in the array, return [-1, -1]. You must&nbsp;write an algorithm with&nbsp;O(lo

read more...

Easy

Search Insert Position

35. Search Insert Position

Given a sorted array of distinct integers and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order. You must&nbsp;write an algorithm with&nbsp;O(log n) runtime complexity. &nbsp; <stron

read more...

Medium

Valid Sudoku

36. Valid Sudoku

Determine if a&nbsp;9 x 9 Sudoku board&nbsp;is valid.&nbsp;Only the filled cells need to be validated&nbsp;according to the following rules: Each row&nbsp;must contain the&nbsp;digits&nbsp;1-9 without repetition. Each column must

read more...