Easy

/Tag:Easy
­

[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] 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] 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 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] 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] 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] 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] 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: , , , |

[Leetcode] Invert Binary Tree

Invert a binary tree.

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

[Leetcode] Binary Tree Preorder Traversal

Given a binary tree, return the preorder traversal of its nodes’ values.

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

[Leetcode] Binary Tree Right Side View

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

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

[Leetcode] Path Sum

Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.

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

[Leetcode] Path Sum II

Given a binary tree and a sum, find all root-to-leaf paths where each path’s sum equals the given sum.

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

[Leetcode] Remove Linked List Elements

Remove all elements from a linked list of integers that have value val.

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

[Leetcode] Rotate List

Given a list, rotate the list to the right by k places, where k is non-negative.

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

[Leetcode] Binary Tree Paths

Given a binary tree, return all root-to-leaf paths.

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

[Leetcode] Same Tree

Given two binary trees, write a function to check if they are equal or not.

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

[Leetcode] Number of 1 Bits

Write a function that takes an unsigned integer and returns the number of ’1' bits it has.

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

[Leetcode] Valid Palindrome

Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.

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

[Leetcode] Merge Sorted Array

Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.

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