摘要:
Sort a linked list using insertion sort. 1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * int val; 5 * ListNode *nex... 阅读全文
摘要:
Given two binary strings, return their sum (also a binary string). For example, a = "11" b = "1" Return "100". Solution: '1'-'0' = 1. 1 class Solution... 阅读全文
摘要:
Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x. You should preserve the ... 阅读全文
摘要:
Given binary tree {1,#,2,3}, 1 \ 2 / 3 return [3,2,1]. Note: Recursive solution is trivial, could you do it iteratively? Solution: 1. Iterative way (... 阅读全文
摘要:
Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level and... 阅读全文
摘要:
Given a binary tree, find the maximum path sum.The path may start and end at any node in the tree. For example: Given the below binary tree, 1 ... 阅读全文