LeetCode Remove Duplicates from Sorted Array Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length. Do not allocate extra space for another array, you must do this in place with constant... Read More

# Monthly Archives: April 2016

# LeetCode Swap Nodes in Pairs

LeetCode Swap Nodes in Pairs Given a linked list, swap every two adjacent nodes and return its head. For example, Given 1->2->3->4, you should return the list as 2->1->4->3. Your algorithm should use only constant space. You may not... Read More

# LeetCode Merge k Sorted Lists

LeetCode Merge k Sorted Lists Merge k sorted linked lists and return it as one sorted list. Analyze and describe its... Read More

# LeetCode Generate Parentheses

LeetCode Generate Parentheses Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. For example, given n = 3, a solution set is: "((()))", "(()())", "(())()", "()(())",... Read More

# LeetCode Merge Two Sorted Lists

LeetCode Merge Two Sorted Lists Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two... Read More

# LeetCode Valid Parentheses

LeetCode Valid Parentheses Given a string containing just the characters '(', ')', '{', '}', '', determine if the input string is valid. The brackets must close in the correct order, "()" and "()[]{}" are all valid but "(]" and "(" are... Read More

# LeetCode Remove Nth Node From End of List

LeetCode Remove Nth Node From End of List Given a linked list, remove the nth node from the end of list and return its head. For example, Given linked list: 1->2->3->4->5, and n = 2. After removing the second node from the end, the... Read More

# LeetCode Letter Combinations of a Phone Number

LeetCode Letter Combinations of a Phone Number Given a digit string, return all possible letter combinations that the number could represent. A mapping of digit to letters (just like on the telephone buttons) is given below. Input:Digit string... Read More