.jpeg)
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.
Example 1:
1 | Input: lists = [[1,4,5],[1,3,4],[2,6]] |
Example 2:
1 | Input: lists = [] |
.jpeg)
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.
Example 1:
1 | Input: lists = [[1,4,5],[1,3,4],[2,6]] |
Example 2:
1 | Input: lists = [] |
.jpeg)
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.
Example 1:
1 | Input: l1 = [1,2,4], l2 = [1,3,4] |
Example 2:
1 | Input: l1 = [], l2 = [] |
Example 3:
1 | Input: l1 = [], l2 = [0] |
.jpeg)
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 same type of brackets.
Open brackets must be closed in the correct order.
Example 1:
1 | Input: s = "()" |
Example 2:
1 | Input: s = "()[]{}" |
Example 3:
1 | Input: s = "(]" |
Example 4:
1 | Input: s = "([)]" |
Example 5:
1 | Input: s = "{[]}" |
.jpeg)
Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.
Notice that the solution set must not contain duplicate triplets.
Example 1:
1 | Input: nums = [-1,0,1,2,-1,-4] |
Example 2:
1 | Input: nums = [] |
Example 3:
1 | Input: nums = [0] |
.jpeg)
Given the head of a linked list, remove the nth node from the end of the list and return its head.
Follow up: Could you do this in one pass?
Example 1:
1 | Input: head = [1,2,3,4,5], n = 2 |
Example 2:
1 | Input: head = [1], n = 1 |
Example 3:
1 | Input: head = [1,2], n = 1 |