Coding Problems

/Tag:Coding Problems
­

[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.

November 14th, 2015|Categories: DS and Algorithms, Linked List|Tags: , , , , |

[Leetcode] Contains Duplicate

Given an array of integers, find if the array contains any duplicates.

November 14th, 2015|Categories: DS and Algorithms, Hash|Tags: , , , |

[Leetcode] Kth Smallest Element in a BST

Given a binary search tree, find the kth smallest element in it.

November 14th, 2015|Categories: DS and Algorithms, Tree|Tags: , , , , , |

[Leetcode] Kth Largest Element in an Array

Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element.

November 28th, 2015|Categories: DS and Algorithms, Sorting|Tags: , , , , , |

[Leetcode] Find Peak Element

Find a peak element in an array and return its index.

November 14th, 2015|Categories: DS and Algorithms, Searching|Tags: , , , , |

[Leetcode] Power of Two

Given an integer, write a function to determine if it is a power of two.

November 14th, 2015|Categories: Bit Manipulation, DS and Algorithms, Math|Tags: , , , |

[Leetcode] Find the Duplicate Number

Find a duplicate in an array with some other requirements.

November 14th, 2015|Categories: DS and Algorithms, Searching|Tags: , , , |

[Leetcode] Rotate Array

Rotate an array of n elements to the right by k steps.

November 14th, 2015|Categories: Array, DS and Algorithms|Tags: , , , |

[Leetcode] Maximum Depth of Binary Tree

Given a binary tree, find its maximum depth.

November 14th, 2015|Categories: DS and Algorithms, Graph, Recursion, Tree|Tags: , , , , , |

[Leetcode] Minimum Depth of Binary Tree

Given a binary tree, find its minimum depth.

November 14th, 2015|Categories: DS and Algorithms, Graph, Tree|Tags: , , , , , , |

[Leetcode] Reverse Integer

Reverse digits of an integer. Return 0 when the reversed integer overflows.

November 14th, 2015|Categories: DS and Algorithms, Math|Tags: , , , , |

[Leetcode] Reverse Linked List

Reverse a singly linked list.

November 14th, 2015|Categories: DS and Algorithms, Linked List|Tags: , , , |

[Leetcode] Add Two Numbers

Add two linked lists representing two non-negative numbers.

November 14th, 2015|Categories: DS and Algorithms, Linked List|Tags: , , , |

[Leetcode] Longest Substring Without Repeating Characters

Given a string, find the length of the longest substring without repeating characters.

November 14th, 2015|Categories: DS and Algorithms, Hash|Tags: , , , |

[Leetcode] Add Binary

Given two binary strings, return their sum (also a binary string).

November 14th, 2015|Categories: DS and Algorithms, Math, String|Tags: , , , , |

[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 lists.

November 14th, 2015|Categories: DS and Algorithms, Linked List|Tags: , , , |

[Leetcode] Contains Duplicate II

Find if a duplicate exists among the recent k numbers.

November 14th, 2015|Categories: DS and Algorithms, Hash|Tags: , , , , |

[Leetcode] Linked List Cycle

Given a linked list, determine if it has a cycle in it.

November 14th, 2015|Categories: DS and Algorithms, Linked List|Tags: , , , , |

[Leetcode] Linked List Cycle II

Given a linked list, return the node where the cycle begins. If there is no cycle, return null.

November 28th, 2015|Categories: DS and Algorithms, Linked List|Tags: , , , , |

[Leetcode] Plus One

Given a non-negative number represented as an array of digits, plus one to the number.

November 14th, 2015|Categories: Array, DS and Algorithms, Math|Tags: , , , , |

[Leetcode] Swap Nodes in Pairs

Given a linked list, swap every two adjacent nodes and return its head.

November 14th, 2015|Categories: DS and Algorithms, Hash, Linked List|Tags: , , , |

[Leetcode] Count and Say

Get the nth sequence of the count-and-say sequences.

November 14th, 2015|Categories: DS and Algorithms, String|Tags: , , , |

[Leetcode] Sum Root to Leaf Numbers

Calculate the total sum of all root-to-leaf numbers.

November 14th, 2015|Categories: DS and Algorithms, Recursion, Tree|Tags: , , , , , |

[Leetcode] Length of Last Word

Given a string s consists of upper/lower-case alphabets and empty space characters ‘ ‘, return the length of last word in the string.

November 14th, 2015|Categories: DS and Algorithms, String|Tags: , , , |

[Leetcode] 3Sum

Given an array S of n integers, find there elements a, b, c in S such that a + b + c = 0.

November 14th, 2015|Categories: Array, DS and Algorithms|Tags: , , , , |

[Leetcode] 3Sum closest

Given an array S of n integers, find three integers in S such that the sum is closest to a given number.

November 14th, 2015|Categories: Array, DS and Algorithms|Tags: , , , , |

[Leetcode] Remove Element

Given an array and a value, remove all instances of that value in place and return the new length.

November 14th, 2015|Categories: Array, DS and Algorithms|Tags: , , , |

[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.

November 14th, 2015|Categories: Array, DS and Algorithms|Tags: , , , , |

[Leetcode] Generate Parentheses

Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.

November 14th, 2015|Categories: Array, DS and Algorithms|Tags: , , , |

[Leetcode] Valid Parentheses

Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.

November 14th, 2015|Categories: DS and Algorithms, Stack, String|Tags: , , , |