Articles

  • 58 - 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.If the last word does not exist, return 0.

    Read More »

  • Space Replacement

    Write a method to replace all spaces in a string with \%20. The string is given in a characters array, you can assume it has enough space for replacement and you are given the true length of the string.

    Read More »

  • 5 - Longest Palindromic Substring

    Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longest palindromic substring.

    Read More »

  • 125 - Valid Palindrome

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

    Read More »

  • 151 - Reverse Words in a String

    Given an input string, reverse the string word by word.

    Read More »

  • Rotate String

    Given a string and an offset, rotate string by offset. (rotate from left to right)

    Read More »

  • Longest Common Substring

    Given two strings, find the longest common substring. Return the length of it.

    Read More »

  • 49 - Group Anagrams

    Given an array of strings, return all groups of strings that are anagrams.

    Read More »

  • Compare Strings

    Compare two strings A and B, determine whether A contains all of the characters in B. The characters in string A and B are all Upper Case letters.

    Read More »

  • Two Strings Are Anagrams

    Write a method anagram(s,t) to decide if two strings are anagrams or not.

    Read More »

  • 28 - Implement strStr()

    Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.

    Read More »

  • Find sum

    find the length of longest substring with left sum equal to right sum

    Read More »

  • Sort array

    Given sorted array of doubles, return the another sorted array of doubles where all elements are the squares from the input array.

    Read More »

  • 181 - Flip Bits

    Determine the number of bits required to flip if you want to convert integer n to integer m.

    Read More »

  • 237 - Delete Node in the Middle of Singly Linked List

    Implement an algorithm to delete a node in the middle of a singly linked list, given only access to that node.

    Read More »

  • 450 - Delete Node in a BST

    Given a root node reference of a BST and a key, delete the node with the given key in the BST. Return the root node reference (possibly updated) of the BST.

    Read More »

  • 2 - Add Two Numbers

    You have two numbers represented by a linked list, where each node contains a single digit. The digits are stored in reverse order, such that the 1’s digit is at the head of the list. Write a function that adds the two numbers and returns the sum as a linked list.

    Read More »

  • 67 - Add Binary

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

    Read More »

  • Insert Node In A Binary Search Tree


    layout: post title: 85 - Insert Node in a Binary Search Tree date: 2015-10-21 02:57:36.000000000 -04:00 tags:

    • Lintcode categories:
    • Binary Search Tree author: Jason – Given a binary search tree and a new tree node, insert the node into the tree. You should keep the tree still be a valid binary search tree.

    Read More »