![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
LeetCode
kevinzhou93
这个作者很懒,什么都没留下…
展开
-
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 · 376 阅读 · 0 评论 -
记录下自己拙计的算法之旅 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 · 357 阅读 · 0 评论 -
[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 · 400 阅读 · 0 评论 -
[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 · 692 阅读 · 0 评论 -
[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 · 310 阅读 · 0 评论 -
[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 · 445 阅读 · 0 评论 -
[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 · 301 阅读 · 0 评论