GeetCode Hub

Easy

Roman to Integer

13. Roman to Integer

Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. Symbol Value I 1 V 5 X 10 L

read more...

Easy

Longest Common Prefix

14. Longest Common Prefix

Write a function to find the longest common prefix string amongst an array of strings. If there is no common prefix, return an empty string "". &nbsp; Example 1: Input: strs = ["flower","flow","flight"] Output:</

read more...

Medium

3Sum

15. 3Sum

Given an integer array nums, return all the triplets [nums[i], nums[j], nums[k]] such that i != j, i != k, and j != k, and nums[i] + nums[j] + nums[k] == 0. Notice that the solution set must not contain duplicate triplets.</p

read more...

Medium

3Sum Closest

16. 3Sum Closest

Given an array nums of n integers and an integer target, find three integers in nums&nbsp;such that the sum is closest to&nbsp;target. Return the sum of the three integers. You may assume that each input would have exactly one solution.

read more...

Medium

Letter Combinations of a Phone Number

17. Letter Combinations of a Phone Number

Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent. Return the answer in any order. A mapping of digit to letters (just like on the telephone buttons) is given below. Note that 1 does no

read more...

Medium

4Sum

18. 4Sum

Given an array nums of n integers, return an array of all the unique quadruplets [nums[a], nums[b], nums[c], nums[d]] such that: 0 &lt;= a, b, c, d&nbsp;&lt; n a, b, <code

read more...

Medium

Remove Nth Node From End of List

19. Remove Nth Node From End of List

Given the head of a linked list, remove the nth node from the end of the list and return its head. &nbsp; Example 1: <img style="width: 542px; height: 222px;" src="https://raw.githubusercontent.com/sumitc91/GeetCodeImage/m

read more...

Easy

Valid Parentheses

20. Valid Parentheses

Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. An input string is valid if: Open brackets must be closed by the

read more...

Easy

Merge Two Sorted Lists

21. Merge Two Sorted Lists

Merge two sorted linked lists and return it as a sorted list. The list should be made by splicing together the nodes of the first two lists. &nbsp; Example 1: <img style="width: 662px; height: 302px;" src="https://raw.githubusercontent.com/su

read more...

Medium

Generate Parentheses

22. Generate Parentheses

Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. &nbsp; Example 1: Input: n = 3 Output: ["((()))","(()())","(())()","()(())","()()()"] <

read more...

Hard

Merge k Sorted Lists

23. Merge k Sorted Lists

You are given an array of k linked-lists lists, each linked-list is sorted in ascending order. Merge all the linked-lists into one sorted linked-list and return it. &nbsp; Example 1: Input: lists =

read more...

Medium

Swap Nodes in Pairs

24. Swap Nodes in Pairs

Given a&nbsp;linked list, swap every two adjacent nodes and return its head. You must solve the problem without&nbsp;modifying the values in the list's nodes (i.e., only nodes themselves may be changed.) &nbsp; Example 1: <img style="width: 422px; height: 222

read more...