XOR Linked List

I just implemented a XOR linked list: [code language="c"] #include <stdio.h> #include <malloc.h> #include <memory> struct node { int val = 0; struct node* next = NULL; ...

94. Binary Tree Inorder Traversal

Given a binary tree, return the inorder traversal of its nodes' values. For example: Given binary tree [1,null,2,3],
   1
    \
     2
    /
   3
return

132. Palindrome Partitioning II

Given a string s, partition s such that every substring of the partition is a palindrome. Return the minimum cuts needed for a palindrome partitioning of s. For example, giv...

155. Min Stack

Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.
  • push(x) -- Push element x onto stack.
  • pop() -- Removes the element on top of ...

124. Binary Tree Maximum Path Sum

Given a binary tree, find the maximum path sum. For this problem, a path is defined as any sequence of nodes from some starting node to any node in the tree along the parent-child connections. The ...

Symmetric Tree

Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree [1,2,2,3,4,4,3] is symmetric:
    1
   / \
  2   2
...
			

347. Top K Frequent Elements

Given a non-empty array of integers, return the k most frequent elements. For example, Given [1,1,1,2,2,3] and k = 2, return [1,2]. Note:
    ...

160. Intersection of Two Linked Lists

Write a program to find the node at which the intersection of two singly linked lists begins.   For example, the following two linked lists:
A:          a1 → a2
                   ...
			

Everyone I’m back!

For some stupid reasons, my website had crashed down for 3 months. Because I was quite busy to prepare interviews and exams, I had no time to dispose the problem. This weekend, I spent all of my free...