自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(20)
  • 资源 (9)
  • 收藏
  • 关注

原创 407. Trapping Rain Water II

package leetcode;import java.util.*;public class Solution{ class Cell{ int col; int row; int height; public Cell(int col,int row,int height){ this.col=c

2017-01-24 12:35:45 319

原创 406. Queue Reconstruction by Height

public class Solution { public int[][] reconstructQueue(int[][] people) { Arrays.sort(people,new Comparator<int[]>(){ public int compare(int[] a1,int[] a2){ retu

2017-01-17 15:39:27 269

原创 405. Convert a Number to Hexadecimal

public class Solution { public String toHex(int num) { char[] mymap={'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'}; String s=""; if(num==0) re

2017-01-17 10:59:18 240

原创 404. Sum of Left Leaves

class Solution {private: int count=0; void sumhelper(TreeNode* root,bool isleft) { if(!root) return; if(isleft&&!root->left&&!root->right) count+=ro

2017-01-17 10:22:39 264

原创 402. Remove K Digits

public class Solution { public static String removeKdigits(String num, int k) { int digits=num.length()-k; int top=0; char[] stack=new char[num.length()]; for(int i=

2017-01-15 12:09:27 298

原创 400. Nth Digit

class Solution {public: int findNthDigit(int n) { /* * 首先定位到包含n的这个数字有几位 * 然后定位到包含n的这个数字是什么 * 最后定位到n是这个数字的第几位 */ long digit=1,base=9,ith=1;//digi

2017-01-15 10:53:19 289

原创 399. Evaluate Division

结题思路是: a/b=v 可以看成是一个又a点指向b点的有向图 边的权值为v 有了a指向b的边 就有 b指向a的边 大小为1/v 则求 c/v 的话就是在图中寻找一条由c指向v的边 将边上所有的权值相乘即可。public class Solution { public double[] calcEquation(String[][] equations, double[] va

2017-01-14 15:42:46 352

原创 398. Random Pick Index

public class Solution { private int[] nums; private Random random; public Solution(int[] nums) { this.nums=nums; random=new Random(); } public int pick(int target) {

2017-01-14 12:23:15 280

原创 Integer Replacement

public class Solution { public int integerReplacement(int n) { int c = 0; while (n != 1) { if ((n & 1) == 0) { n >>>= 1; } else if (n == 3 || Integer.bitCount(n +

2017-01-13 20:24:41 341

原创 396. Rotate Function

class Solution {public: int maxRotateFunction(vector<int>& A) { int F=0; int sum=0; for(int i=0;i<A.size();i++) { sum+=A[i]; F+=i*A[i];

2017-01-13 10:47:16 240

原创 395. Longest Substring with At Least K Repeating Characters

public class Solution { public int longestSubstring(String s, int k) { char [] string =s.toCharArray(); return helper(string,0,s.length(),k);//求每个字符的出现次数 都 >=k 的最长子字符串的长度 }

2017-01-12 11:12:00 263

原创 394. Decode String

public class Solution { public String decodeString(String s) { Stack repeattimes=new Stack<>(); Stack res=new Stack<>(); String cur=”“; int idx=0; whil

2017-01-11 15:21:42 315

原创 392. Is Subsequence

class Solution {public: bool isSubsequence(string s, string t) { auto it=s.begin(); for(char c:t) { it+=((*it)==c); } return it==s.end(); }

2017-01-11 12:52:25 305

原创 391. Perfect Rectangle

class Solution {public: bool isRectangleCover(vector<vector<int>>& rectangles) { unordered_set<string> s; int x1=INT_MAX; int y1=INT_MAX; int x2=INT_MIN; in

2017-01-10 13:56:10 349

原创 390. Elimination Game

class Solution {public: int lastRemaining(int n) { int head=1; int remain=n; int setp=1; bool forward=true; while(remain>1) { if(forward

2017-01-09 11:00:04 332

原创 389. Find the Difference

class Solution {public: char findTheDifference(string s, string t) { map<char,int> tm; map<char,int> sm; for(int i=0;i<t.size();i++) tm[t[i]]++; for(int

2017-01-08 23:05:28 267

原创 385. Mini Parser

package leetcode;import java.util.*;public class Solution { public NestedInteger deserialize(String s) { if(s.isEmpty()) return null; if(s.charAt(0)!='[') return new Neste

2017-01-07 11:46:40 439

原创 381. Insert Delete GetRandom O(1) - Duplicates allowed

public class RandomizedCollection { private List<Integer> nums; private Map<Integer,Set<Integer>> indexs; private Random r; /** Initialize your data structure here. */ public Random

2017-01-05 16:14:55 289

原创 380. Insert Delete GetRandom O(1)

public class RandomizedSet { private HashMap<Integer,Integer> m; private ArrayList<Integer> a; private Random r; /** Initialize your data structure here. */ public RandomizedSet() {

2017-01-05 10:41:51 347

原创 384. Shuffle an Array

public class Solution { private int[] nums; private Random r; public Solution(int[] nums) { this.nums=nums; r=new Random(); } /** Resets the array to its original con

2017-01-04 10:55:34 370

PID算法介绍

pid算法是用于反馈控制的算法 适合于工业控制

2012-10-07

数字电路教程

很好的数字电路入门资源,非常适合入门 数字电路是基础哦

2012-09-23

TMP100驱动

温度传感器TMP100的驱动代码,可以直接拿过来用的

2012-09-18

安卓开发门必读

安卓开发必读 Android

2012-05-13

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除