- 博客(7)
- 收藏
- 关注
原创 Binary Tree Preorder Traversal
Given a binary tree, return the preorder traversal of its nodes’ values.For example: Given binary tree {1,#,2,3}, 1 \ 2 / 3 return [1,2,3].Note: Recursive solution is trivial,
2016-08-05 09:33:09 185
原创 Valid Anagram
Given two strings s and t, write a function to determine if t is an anagram of s.For example, s = “anagram”, t = “nagaram”, return true. s = “rat”, t = “car”, return false.Note: You may assume the s
2016-08-03 10:19:52 208
原创 Top K Frequent Element
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: You may assume k is always valid, 1 ≤ k ≤ number of unique ele
2016-08-01 06:27:28 172
原创 Same Tree
Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical and the nodes have the same value.利用递归便可轻松解决/** * De
2016-08-01 06:24:03 142
原创 Intersection of Two Arrays
Given two arrays, write a function to compute their intersection.Example: Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2].Note: Each element in the result must be unique. The result can be in
2016-08-01 06:22:04 128
原创 Product of Array Except Self
Given an array of n integers where n > 1, nums, return an array output such that output[i] is equal to the product of all the elements of nums except nums[i].Solve it without division and in O(n).For e
2016-08-01 06:16:49 205
原创 数据结构(java)----BinarySearchTree
写一个BST的java语言实现import org.omg.CORBA.UserException; public class BinarySearchTree<AnyType extends Comparable<? super AnyType>> { private static class BinaryNode<AnyType> { BinaryNode(Any
2016-08-01 06:11:42 261
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人