上一页 1 ··· 4 5 6 7 8 9 10 11 下一页

2019年2月25日

包含min函数的栈 (剑指offer)

摘要: 定义栈的数据结构,请在该类型中实现一个能够得到栈中所含最小元素的min函数(时间复杂度应为O(1))。 分析:1、对于抽象问题,可以尝试用举例法理解题目 2、栈:先进后出 入栈和出栈的时间复杂度都是1。 但是查找最小值就有点麻烦。加入我用变量存栈的最小值那么就有一个问题。如果最小值被弹出怎么办?所以 阅读全文

posted @ 2019-02-25 17:07 shaer 阅读(186) 评论(0) 推荐(0) 编辑

75. Sort Colors(按颜色进行排序)(leetcode)

摘要: Given an array with n objects colored red, white or blue, sort them in-place so that objects of the same color are adjacent, with the colors in the or 阅读全文

posted @ 2019-02-25 14:52 shaer 阅读(248) 评论(0) 推荐(0) 编辑

2019年2月24日

Arrays.sort()源码分析

摘要: 转处:https://www.cnblogs.com/gw811/archive/2012/10/04/2711746.html 阅读全文

posted @ 2019-02-24 21:58 shaer 阅读(225) 评论(0) 推荐(0) 编辑

2019年2月23日

215. Kth Largest Element in an Array(返回数组中第几大元素)(leetcode)

摘要: Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element. Example 阅读全文

posted @ 2019-02-23 20:14 shaer 阅读(98) 评论(0) 推荐(0) 编辑

524. Longest Word in Dictionary through Deleting(通过删除找到字典中最长的单词)(leetcode)

摘要: Given a string and a string dictionary, find the longest string in the dictionary that can be formed by deleting some characters of the given string. 阅读全文

posted @ 2019-02-23 16:27 shaer 阅读(105) 评论(0) 推荐(0) 编辑

2019年2月22日

hashset和hashmap的区别

摘要: HashMap和HashSet的区别是Java面试中最常被问到的问题。如果没有涉及到Collection框架以及多线程的面试,可以说是不完整。而Collection框架的问题不涉及到HashSet和HashMap,也可以说是不完整。HashMap和HashSet都是collection框架的一部分, 阅读全文

posted @ 2019-02-22 18:08 shaer 阅读(532) 评论(0) 推荐(0) 编辑

141. Linked List Cycle(判断l链表是否有环)(leetcode)

摘要: Given a linked list, determine if it has a cycle in it. To represent a cycle in the given linked list, we use an integer pos which represents the posi 阅读全文

posted @ 2019-02-22 17:34 shaer 阅读(145) 评论(0) 推荐(0) 编辑

88. Merge Sorted Array(归并两个数组)(leetcode)

摘要: Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array. Note: The number of elements initialized in nums1 and num 阅读全文

posted @ 2019-02-22 17:06 shaer 阅读(98) 评论(0) 推荐(0) 编辑

345. Reverse Vowels of a String(交换元音字母)(leetcode)

摘要: Write a function that takes a string as input and reverse only the vowels of a string. Example 1: Example 2: Input: "leetcode" Output: "leotcede" Exam 阅读全文

posted @ 2019-02-22 14:58 shaer 阅读(148) 评论(0) 推荐(0) 编辑

633. Sum of Square Numbers(平方和)(leetcode)

摘要: 题目: Given a non-negative integer c, your task is to decide whether there're two integers a and b such that a2 + b2 = c. Example 1: Example 2: 方法二:数学方法 阅读全文

posted @ 2019-02-22 14:56 shaer 阅读(157) 评论(0) 推荐(0) 编辑

上一页 1 ··· 4 5 6 7 8 9 10 11 下一页

导航