自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

Yingying

你必须非常努力,才能看起来毫不费力

  • 博客(66)
  • 收藏
  • 关注

原创 151. Reverse Words in a String**

Given an input string, reverse the string word by word.For example,Given s = "the sky is blue",return "blue is sky the". public String reverseWords(String s) { String[] parts = s.tr

2016-12-28 21:55:46 278

原创 125. Valid Palindrome*

Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a plan, a canal: Panama" is a palindrome."race a car" is not a

2016-12-27 22:22:37 262

原创 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.Note: A word is

2016-12-27 21:35:35 244

原创 165. Compare Version Numbers*

Compare two version numbers version1 and version2.If version1 > version2 return 1, if version1 version2 return -1, otherwise return 0.You may assume that the version strings are non-empty and co

2016-12-27 21:30:47 240

原创 38. Count and Say*

The count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211, 111221, ...1 is read off as "one 1" or 11.11 is read off as "two 1s" or 21.21 is read off

2016-12-25 22:22:26 203

原创 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.My code: public int strStr(String haystack, String needle) {

2016-12-25 21:43:42 191

原创 434. Number of Segments in a String*

Count the number of segments in a string, where a segment is defined to be a contiguous sequence of non-space characters.Please note that the string does not contain any non-printable characters.

2016-12-25 20:48:39 261

原创 14. Longest Common Prefix**

Write a function to find the longest common prefix string amongst an array of strings.Method1:public class Solution { public String longestCommonPrefix(String[] strs) { if(strs==null |

2016-12-25 20:12:15 218

原创 6. ZigZag Conversion*

The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)P A H NA P L S I

2016-12-24 22:37:34 207

原创 116. Populating Next Right Pointers in Each Node**

Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; }Populate each next pointer to point to its next right node.

2016-12-24 18:20:06 199

原创 337. House Robber III**

The thief has found himself a new place for his thievery again. There is only one entrance to this area, called the "root." Besides the root, each house has one and only one parent house. After a tour

2016-12-24 15:40:08 303

原创 129. Sum Root to Leaf Numbers**

Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number.An example is the root-to-leaf path 1->2->3 which represents the number 123.Find the tota

2016-12-24 15:13:04 251

原创 173. Binary Search Tree Iterator**

mplement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST.Calling next() will return the next smallest number in the BST.Note: next() 

2016-12-24 14:35:54 292

原创 199. Binary Tree Right Side View**

Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom.For example:Given the following binary tree, 1

2016-12-24 14:08:54 209

原创 222. Count Complete Tree Nodes**

Given a complete binary tree, count the number of nodes.Definition of a complete binary tree from Wikipedia:In a complete binary tree every level, except possibly the last, is completely fille

2016-12-24 13:23:10 309

原创 105. Construct Binary Tree from Preorder and Inorder Traversal**

Given preorder and inorder traversal of a tree, construct the binary treepublic class Solution { public TreeNode buildTree(int[] preorder, int[] inorder) { return helper(0,0,inorder.leng

2016-12-24 12:38:32 227

原创 230. Kth Smallest Element in a BST**

Given a binary search tree, write a function kthSmallest to find the kth smallest element in it.Note: You may assume k is always valid, 1 ≤ k ≤ BST's total elements.Follow up:What if the

2016-12-23 21:56:36 189

原创 A convolutional Neural Network for Modelling Sentences

2014 牛津大学提出了一种新的CNN架构,可处理不同长度的时间序列,提出k-max pooling步骤:将整个句子进行编码,获得d*s的矩阵,对于每行进行一维卷积,然后取出前k大的数值作为特征序列,保留了原始值的相对位置,但是省略了具体位置信息。最顶层时,将相邻两row相加(folding),实现不同row之间信息共享。实验部分:用在语义分

2016-12-23 15:43:26 1519

原创 103. Binary Tree Zigzag Level Order Traversal

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 alternate between).For example:Given binary

2016-12-22 23:43:59 189

原创 236. Lowest Common Ancestor of a Binary Tree**

Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.According to the definition of LCA on Wikipedia: “The lowest common ancestor is defined between two node

2016-12-22 23:22:01 210

原创 110. Balanced Binary Tree*

Given a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees of every node never diffe

2016-12-22 21:49:26 229

原创 101. 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 / \ / \3 4 4 3

2016-12-22 20:42:53 222

原创 100. 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.My code:

2016-12-22 20:00:59 201

原创 111. Minimum Depth of Binary Tree*

Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.My code:# Definition for a binar

2016-12-22 19:54:31 194

原创 112. Path Sum*

Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.For example:Given the below binary tree and sum

2016-12-21 21:13:55 227

原创 235. Lowest Common Ancestor of a Binary Search Tree*

Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST.According to the definition of LCA on Wikipedia: “The lowest common ancestor is defined betwee

2016-12-21 20:35:12 214

原创 257. Binary Tree Paths*

Given a binary tree, return all root-to-leaf paths.For example, given the following binary tree: 1 / \2 3 \ 5All root-to-leaf paths are:["1->2->5", "1->3"]public List binar

2016-12-21 19:55:23 220

转载 Java Vector 类

转载自Java Vector 类Vector类实现了一个动态数组。和ArrayList和相似,但是两者是不同的:Vector是同步访问的。Vector包含了许多传统的方法,这些方法不属于集合框架。Vector主要用在事先不知道数组的大小,或者只是需要一个可以改变大小的数组的情况。Vector类支持4种构造方法。第一种构造方法创建一个默认的向量,默认大小为10:V

2016-12-21 19:44:04 310

原创 404. Sum of Left Leaves*

Find the sum of all left leaves in a given binary tree.Example: 3 / \ 9 20 / \ 15 7There are two left leaves in the binary tree, with values 9 and 15 respectively. Return 24

2016-12-20 23:47:56 210

原创 107. Binary Tree Level Order Traversal II*

Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root).For example:Given binary tree [3,9,20,null,null,1

2016-12-19 23:44:43 242

原创 102. Binary Tree Level Order Traversal*

Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level).For example:Given binary tree [3,9,20,null,null,15,7], 3 / \ 9 2

2016-12-19 23:15:21 165

原创 RNN资源博客 Recurrent Neural Network的经典论文、代码、课件、博士论文和应用汇总

转载自:RNN资源博客字数1701 阅读5199 评论2 喜欢4Awesome Recurrent Neural NetworksA curated list of resources dedicated to recurrent neural networks (closely related todeep learning).Maintainers -Jiwon

2016-12-19 13:55:16 5097

原创 Paper tp read

Link prediction in social network Jon Kleinberg

2016-12-19 10:48:02 243

原创 150. Evaluate Reverse Polish Notation**

Evaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are +, -, *, /. Each operand may be an integer or another expression.Some examples: ["2", "1",

2016-12-18 22:55:04 282

原创 144. 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 / 3return [1,2,3].Note: Recursive soluti

2016-12-18 10:44:16 200

原创 71. Simplify Path**

Given an absolute path for a file (Unix-style), simplify it.For example,path = "/home/", => "/home"path = "/a/./b/../../c/", => "/c"click to show corner cases.Corner Cases:Did

2016-12-17 23:47:32 205

原创 456. 132 Pattern**

Given a sequence of n integers a1, a2, ..., an, a 132 pattern is a subsequence ai, aj, ak such that i j k and ai < ak j. Design an algorithm that takes a list of n numbers as input and check

2016-12-17 19:16:59 236

转载 Morris Traversal 方法遍历二叉树

Reference本文主要解决一个问题,如何实现二叉树的前中后序遍历,有两个要求:1. O(1)空间复杂度,即只能使用常数空间;2. 二叉树的形状不能被破坏(中间过程允许改变其形状)。通常,实现二叉树的前序(preorder)、中序(inorder)、后序(postorder)遍历有两个常用的方法:一是递归(recursive),二是使用栈实现的迭代版本

2016-12-17 18:34:25 243

原创 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 / 3return [1,3,2].Note: Recursive solu

2016-12-17 18:15:16 193

原创 331. Verify Preorder Serialization of a Binary Tree

One way to serialize a binary tree is to use pre-order traversal. When we encounter a non-null node, we record the node's value. If it is a null node, we record using a sentinel value such as #.

2016-12-17 15:48:26 220

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除