摘要:
Given a binary tree, return the preorder traversal of its nodes' values. Given binary tree {1,#,2,3}, 1 \ 2 / 3 return [1,2,3]. Note: Recursive soluti 阅读全文
摘要:
Sort a linked list in O(n log n) time using constant space complexity. 利用归并排序的思想,递归合并两个有序的链表。 首先将链表递归分成两部分,直到只有一个结点为止,然后从底到上合并链表。 当然是学习大牛代码后写出的,如下: 阅读全文
摘要:
Given an array of integers, every element appears twice except for one. Find that single one. Note: Your algorithm should have a linear runtime comple 阅读全文
摘要:
You are given two non - empty linked lists representing two non - negative integers. The digits are stored in reverse order and each of their nodes co 阅读全文
摘要:
Evaluate the value of an arithmetic expression in Reverse Polish Notation. Valid operators are +, -, *, /. Each operand may be an integer or another e 阅读全文
摘要:
Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have ex 阅读全文