- 博客(7)
- 资源 (1)
- 收藏
- 关注
原创 [LeetCode]Maximum 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.首先,根据深度优先搜索的思路,用递归来做java code如下public int m
2015-05-10 20:59:11
336
原创 [LeetCode]Valid Sudoku
Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules.The Sudoku board could be partially filled, where empty cells are filled with the character ‘.’. A partially filled sudoku whic
2015-05-09 15:01:38
723
原创 [LeetCode] Valid parentheses
Given a string containing just the characters ‘(‘, ‘)’, ‘{‘, ‘}’, ‘[’ and ‘]’, determine if the input string is valid.The brackets must close in the correct order, “()” and “()[]{}” are all valid but “
2015-05-04 22:15:54
328
原创 [LeetCode] Remove Linked List Elements
Remove all elements from a linked list of integers that have value val.Example Given: 1 –> 2 –> 6 –> 3 –> 4 –> 5 –> 6, val = 6 Return: 1 –> 2 –> 3 –> 4 –> 5java code/** * Definition for singly-linke
2015-05-03 22:58:06
484
原创 [LeetCode]Roman to Integer
guarantee了输入,简单好多 = = ruby code实现如下# @param {String} s# @return {Integer}def roman_to_int(s) symbols = {"I" => 1, "V" => 5, "X" => 10, "L" => 50, "C" => 100, "D" => 500, "M" => 1000} result =
2015-04-26 21:46:02
428
原创 LeetCode - StringToInteger - java
基本在submit, 修改,submit,修改……public int myAtoi(String str) { str = str.trim(); int n = str.length(); if (n == 0) return 0; char firstChar = str.charAt(0); if(firstCh
2015-04-22 15:36:35
404
原创 记录下自己拙计的算法之旅 LeetCode Rotate Array
记录下自己拙计的算法之旅LeetCode Rotate Arraydef rotate(nums, k) num_cp = nums.clone pos = k % nums.length start_pos = 0 nums.length.times do nums[pos] = num_cp[start_pos] start_pos += 1
2015-04-12 20:56:56
392
密码学SPN分组加解密
2014-04-13
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人