Java
文章平均质量分 67
柯莹
希望我这颗小星球能够变得更加成熟,更加strong,我要做计算界女汉子!!!
展开
-
翻转一棵二叉树 + Java中queue的总结
翻转二叉树,使用Java版实现原创 2015-08-26 10:52:40 · 440 阅读 · 0 评论 -
Remove Duplicates from Sorted List
Given a sorted linked list, delete all duplicates such that each element appear only once.For example,Given 1->1->2, return 1->2.Given 1->1->2->3->3, return 1->2->3.Subscribe to see wh原创 2016-09-01 16:30:53 · 190 阅读 · 0 评论 -
字符串分割--java中String.split()用法
在java.lang包中有String.split()方法,返回是一个数组。 1、“.”和“|”都是转义字符,必须得加"\\"; 如果用“.”作为分隔的话,必须是如下写法:String.split("\\."),这样才能正确的分隔开,不能用String.split(".");如果用“|”作为分隔的话,必须是如下写法:String.split("\\|"),这样才能正确的分隔转载 2017-02-27 21:59:37 · 194 阅读 · 0 评论 -
Lintcode: 尾部的零
尾部的零 设计一个算法,计算出n阶乘中尾部零的个数您在真实的面试中是否遇到过这个题? Yes样例11! = 39916800,因此应该返回 2class Solution { /* * param n: As desciption * return: An int转载 2017-05-09 16:43:50 · 171 阅读 · 0 评论 -
Leetcode: Summary Ranges
Given a sorted integer array without duplicates, return the summary of its ranges.For example, given [0,1,2,4,5,7], return ["0->2","4->5","7"].public class Solution { public List sum原创 2017-03-01 22:06:04 · 130 阅读 · 0 评论 -
剑指offer:旋转数组的最小数字
题目描述把一个数组最开始的若干个元素搬到数组的末尾,我们称之为数组的旋转。输入一个非递减排序的数组的一个旋转,输出旋转数组的最小元素。例如数组{3,4,5,1,2}为{1,2,3,4,5}的一个旋转,该数组的最小值为1。NOTE:给出的所有元素都大于0,若数组大小为0,请返回0。思路剑指Offer中有这道题目的分析。这是一道二分查找的变形的题目。原创 2016-09-13 15:01:33 · 139 阅读 · 0 评论 -
LeetCode:Reverse Linked List
Reverse a singly linked list.思路:注意几个地方:变换前: h ----> i ----> j变换后: h 1 以i节点为当前节点。假设i节点前面的节点都实现了逆转。现在已i节点为参考对象。注意需要用一个新定义的ListNode去记录下i的下一个节点j。因为如果单纯的将j的下一节点指向h,会导致i , j 之间断裂原创 2016-09-05 10:22:13 · 147 阅读 · 0 评论 -
Leetcode:Find the Difference
Given two strings s and t which consist of only lowercase letters.String t is generated by random shuffling string s and then add one more letter at a random position.Find the letter that was原创 2016-08-29 16:41:41 · 526 阅读 · 0 评论 -
leetcode:Contains Duplicate
217. Contains DuplicateGiven an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the array, and it should r原创 2016-06-28 17:00:35 · 182 阅读 · 0 评论 -
leetcode: Majority Element
169. Majority Element My SubmissionsQuestionEditorial SolutionTotal Accepted: 122095 Total Submissions: 289750 Difficulty: EasyGiven an array of size n, find the majority ele原创 2016-06-23 15:01:05 · 325 阅读 · 0 评论 -
leetcode:Reverse String
344. Reverse String My SubmissionsQuestionEditorial SolutionTotal Accepted: 29346 Total Submissions: 50197 Difficulty: EasyWrite a function that takes a string as input and r原创 2016-05-31 14:41:58 · 215 阅读 · 0 评论 -
leetcode: Maximum Depth of Binary Tree
104. Maximum Depth of Binary Tree My SubmissionsQuestionEditorial SolutionTotal Accepted: 149038 Total Submissions: 309044 Difficulty: EasyGiven a binary tree, find its maxim原创 2016-06-04 17:59:26 · 193 阅读 · 0 评论 -
leetcode:Intersection of Two Arrays
349. Intersection of Two Arrays My SubmissionsQuestionEditorial SolutionTotal Accepted: 16575 Total Submissions: 36982 Difficulty: EasyGiven two arrays, write a function to c原创 2016-06-10 19:20:07 · 244 阅读 · 0 评论 -
leetcode:Move Zeroes
283. Move Zeroes My SubmissionsQuestionEditorial SolutionTotal Accepted: 87958 Total Submissions: 196336 Difficulty: EasyGiven an array nums, write a function to move all 0原创 2016-06-10 08:55:46 · 196 阅读 · 0 评论 -
leetcode: Remove Linked List Elements
203. Remove Linked List Elements My SubmissionsQuestionEditorial SolutionTotal Accepted: 66759 Total Submissions: 229425 Difficulty: EasyRemove all elements from a linked lis原创 2016-06-11 17:46:46 · 245 阅读 · 0 评论 -
leetcode: Same Tree
100. Same Tree My SubmissionsQuestionEditorial SolutionTotal Accepted: 133548 Total Submissions: 306562 Difficulty: EasyGiven two binary trees, write a function to check if t原创 2016-06-12 10:25:05 · 294 阅读 · 0 评论 -
leetcode: Excel Sheet Column Title
168. Excel Sheet Column Title My SubmissionsQuestionEditorial SolutionTotal Accepted: 63607 Total Submissions: 286742 Difficulty: EasyGiven a positive integer, return its cor原创 2016-06-12 12:29:48 · 228 阅读 · 0 评论 -
Leetcode: Find the Difference
Given two strings s and t which consist of only lowercase letters.String t is generated by random shuffling string s and then add one more letter at a random position.Find the letter that was原创 2017-06-26 16:12:16 · 183 阅读 · 0 评论