![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Leetcode_Medium
文章平均质量分 76
ALiTuTu
这个作者很懒,什么都没留下…
展开
-
【leetcode】【Medium】【451. Sort Characters By Frequency】【HashMap】【PriorityQueue】【HeapSort】
problem link: https://leetcode.com/problems/sort-characters-by-frequency/note:1.Java集合类priorityqueue优先队列,没用过所以想不到,还想自己写插入排序,Java现成的方法很方便2.想到用桶排序的思想,但是由于考虑到string长度会不会太长以及中文字符的存在而放弃了3.com原创 2017-01-05 23:17:09 · 565 阅读 · 0 评论 -
【leetcode】【Medium】【413. Arithmetic Slices】【Math】【Dynamic programming】
problem linkcode(java 2ms beat 32.44%):public class Solution { public int numberOfArithmeticSlices(int[] A) { int count = 0; int N = A.length; if(N<=2){ return 0; } fo原创 2016-12-24 17:51:50 · 495 阅读 · 0 评论 -
【leetcode】【Medium】【338. Counting Bits】【规律】
注意边界及特殊情况problem link:https://leetcode.com/problems/counting-bits/code1(java 3ms):public class Solution { public int[] countBits(int num) { if(num==0){ return new原创 2016-12-23 00:22:23 · 439 阅读 · 0 评论 -
【Leetcode】238-Product of Array Except Self【Java实现】【Medium】【two way traverse】
复杂度要求O(n),不代表只能遍历一遍,可以遍历2遍、3遍。。。。product--->名词:积stem:Given an array of n integers where n > 1, nums, return an array output such that output[i] is equal to the product of all the elements of num原创 2015-11-11 22:48:25 · 658 阅读 · 1 评论