You are given a path to a file as a string. The path can contain the symbols: “..” for the parent directory and “.” for the current directory. Convert the path into its simplified form.
Find Leaves of Binary Tree
Given a binary tree, extract all the leaves in repeated succession into a list of lists by starting at the bottom and working your way upwards.
Write a program to reverse the given string.
Find Peak Element
Given a two-dimensional binary matrix where 1 represents water and 0 represents land, mutate the matrix in place and return the matrix with the highest peak maximized.
Build a Max Heap From an Array
Given an array of integers, transform the array in-place to a max heap.
Given a 32-bit signed integer, reverse digits of the integer.
Top K Frequent Elements
Given a non-empty array of integers, return the k most frequent elements
Longest Substring Without Repeating Characters
Given a string s, find the length of the longest substring without repeating characters.
Subarray Sum Equals K
Given an unsorted array of integers and an integer k, find the number of subarrays whose sum equals k.
You are given a list of lexicographically sorted words from an alien language. This language has a unique order. Return the alphabetical order of all the letters found in the list of words.
Insert Delete getRandom O(1)
Design and implement an efficient sampler that works in average O(1) time complexity.
Recover Binary Search Tree
Two elements of a binary search tree (BST) are swapped by mistake. Recover the tree without changing its structure.
Given `n` pairs of parentheses, write a function to generate all combinations of well-formed parentheses.
Given a list of meetings, represented as tuples with a start and an end time, determine the minimum number of rooms required to schedule all the meetings.
Given a list of integers L and a number K, write a function that reorganizes L into three partitions: elements less than K, elements equal to K, and elements greater than K. No additional lists may be used.
Right View Of Binary Tree
Given the root of a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom.
Kth Smallest Element
Given an integer array and an integer k, return the kth smallest element in the array.
Given an array of integers, return an array of triplets such that i != j != k and nums[i] + nums[j] + nums[k] = 0.
Number of Islands
Given a 2D matrix, where "1" represents land and "0" represents water, count how many islands are present.
Given an array of integers, return the indices of the two numbers that add up to a given target.
K Closest Points To Origin
Given a list of tuples that represent (X, Y) coordinates on an XY plane and an integer K, return a list of the K-closest points to the origin (0, 0).
Reverse a Linked List
Given the head of a linked list, reverse the list and return the new head.
Count Complete Tree Nodes
Given the root of a complete binary tree, return the number of nodes in the tree.
Given an encoded string, return its decoded string.
Partition to K Equal Sum Subsets
Given an integer array nums and an integer k, return true if it is possible to divide this array into k non-empty subsets whose sums are all equal.
Reverse Words in a String
Given an input string `s`, reverse the order of the words without reversing the words themselves.
Boundary of Binary Tree
The boundary of a binary tree is the concatenation of the root, the left boundary, the leaves ordered from left-to-right, and the reverse order of the right boundary.
Copy List With Random Pointers
Given a linked list with nodes that have an additional pointer referring to another node in the list, return a deep copy of the list.
Longest Common Subsequence
Given two strings, return the longest common subsequence between the two strings.
Find the Missing Number in an Array
Given an unsorted array of unique integers (size n + 1) and a first array identical to the second array but missing one integer (size n), find and output the missing integer.