自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

sherine的博客

取法乎上,仅得乎中

  • 博客(36)
  • 收藏
  • 关注

原创 (Leetcode)400. Nth Digit

400. Nth Digit Find the nth digit of the infinite integer sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, … Note: n is positive and will fit within the range of a 32-bit signed integer (n

2017-09-14 21:46:51 255

原创 (Leetcode)Longest Increasing Subsequence——dp,bisearch

300. Longest Increasing Subsequence 题目 Given an unsorted array of integers, find the length of longest increasing subsequence.For example, Given [10, 9, 2, 5, 3, 7, 101, 18], The longest increasing

2017-03-31 23:17:46 393

原创 optimizer优化算法总结

优化方法总结参考深度学习最全优化方法总结比较An overview of gradient descent optimization algorithms目录优化方法总结SGD1 Batch gradient descent2 Stochastic gradient descent3 Mini-batch gradient descent三种gradient descent对比Mini-

2017-03-17 00:26:01 19449

原创 (Leetcode)Ugly Number

264. Ugly Number IIWrite a program to find the n-th ugly number.Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 1, 2, 3, 4, 5, 6, 8, 9, 10, 12 is the sequence o

2017-01-03 11:22:46 359

原创 原码, 反码, 补码 详解

为看懂Leetcode的260. Single Number III的位运算的解法,专门去补习了一下原码、补码的相关知识。260. Single Number IIIGiven an array of numbers nums, in which exactly two elements appear only once and all the other elements appear exac

2016-12-28 20:29:29 401

原创 (Leetcode)238. Product of Array Except Self

238. Product of Array Except Self 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 nums except nums[i].Solve it

2016-12-27 13:43:10 243

原创 Majority Vote Alogrithm 多数投票算法

当一个序列中存在一个占大多数的的元素的时候(超过50%),该算法可以在O(1)空间和O(n)时间内找出这个元素。Tips: ⌊ 59/60⌋ = 0, floor(),向下取整 Majority Element Given an array of size n, find the majority element. The majority element is the element th

2016-12-25 22:44:44 991 1

原创 Trie(prefix tree,前缀树,字典树)

Trie(Prefix tree, 前缀树,字典树)简介在计算机科学中,trie,又称前缀树或字典树,是一种有序树,用于保存关联数组,其中的键通常是字符串。与二叉查找树不同,键不是直接保存在节点中,而是由节点在树中的位置决定。一个节点的所有子孙都有相同的前缀,也就是这个节点对应的字符串,而根节点对应空字符串。一般情况下,不是所有的节点都有对应的值,只有叶子节点和部分内部节点所对应的键才有相关的值。

2016-12-07 16:04:33 1079

原创 (Leetcode)判断一个图是否是可以拓扑排序的——使用Queue

207. Course Schedule 拓扑排序 Topological Order 对一个有向无环图(Directed Acyclic Graph简称DAG)G进行拓扑排序,是将G中所有顶点排成一个线性序列,使得图中任意一对顶点u和v,若边(u,v)∈E(G),则u在线性序列中出现在v之前。 通常,这样的线性序列称为满足拓扑次序(Topological Orde

2016-12-04 23:30:14 1523

原创 (LeetCode)179. Largest Number——巧用string.compreTo和泛型接口Comparator

179. Largest NumberGiven a list of non negative integers, arrange them such that they form the largest number.For example, given [3, 30, 34, 5, 9], the largest formed number is 9534330.Note: The result

2016-11-16 22:38:15 315

原创 (Leetcode)链表的slow,fast指针使用

141. Linked List CycleGiven a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?Code-Java/** * Definition for singly-linked list. * class ListNode

2016-11-06 15:51:03 974

原创 (Leetcode)利用preorder-inorder/postorder-inorder构建二叉树

105. Construct Binary Tree from Preorder and Inorder Traversal Given preorder and inorder traversal of a tree, construct the binary tree.分析 根据preorder获得root节点(preorder第1个node),通过root在inorder中的位

2016-10-22 01:53:07 1102

原创 (Leetcode)Unique Binary Search Trees I & II

96. Unique Binary Search TreesGiven n, how many structurally unique BST's (binary search trees) that store values 1...n?For example,Given n = 3, there are a total of 5 unique BST's. 1 3

2016-10-20 16:52:58 356

原创 (Leetcode)92. Reverse Linked List II ——反转单链表

92. Reverse Linked List IIReverse a linked list from position m to n. Do it in-place and in one-pass.For example:Given 1->2->3->4->5->NULL, m = 2 and n = 4,return 1->4->3->2->5->NULL.Note:Given m, n

2016-10-09 20:52:18 292

原创 (Leetcode)backtracking回溯法 题目汇总

回溯法 Backtracking Backtracking比较形象来说可以用走迷宫做例子,大多人类一般就是使用回溯法,当走到一条死路,就往回退到前一个岔路,尝试另外一条,直到走出。简介中文称做「**回溯法**」,穷举多维度数据的方法,可以想作是多维度的**穷举搜索(Exhaustive Search)**。大意是:把多维度数据看做是是一个多维向量(solution vector),然后运用递

2016-09-02 17:03:07 1306 1

原创 (Leetcode)371. Sum of Two Integers

371. Sum of Two Integers Calculate the sum of two integers a and b, but you are not allowed to use the operator + and -. Example: Given a = 1 and b = 2, return 3.Solution思路题目要求不用+法进行加法运算,所以考虑

2016-08-28 21:27:47 313

原创 (Leetcode)49. Group Anagrams--Using HashMap

Problem49. Group Anagrams Given an array of strings, group anagrams together. For example, given: [“eat”, “tea”, “tan”, “ate”, “nat”, “bat”], Return: [ [“ate”, “eat”,”tea”], [“

2016-07-07 17:43:54 260

原创 (Leetcode)46&47 Permutations--LinkedList and HashSet

Problem46.Permutations Given a collection of distinct numbers, return all possible permutations. 47. Permutations II Given a collection of numbers that might contain duplicates, return all possib

2016-07-06 17:13:55 251

原创 (Leetcode)43. Multiply Strings

Problem43. Multiply Strings Given two numbers represented as strings, return multiplication of the numbers as a string. Note: The numbers can be arbitrarily large and are non-negative. C

2016-07-02 14:39:28 293

原创 (Leetcode)39&40. Combination Sum--Using Backtracking

Problem39. Combination Sum Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T. The same repeated number may be ch

2016-07-01 13:46:40 562

原创 (Leetcode)37. Sudoku Solver

回溯法(Backtracking)求数独的解回溯法 Backtracking 深度优先搜索 策略 遍历空间树,找到一个结点。如果符合解的要求,则继续向下探索;如果不符合解的要求,则退回其父节点。 比较形象来说可以用走迷宫做例子,大多人类一般就是使用回溯法,当走到一条死路,就往回退到前一个岔路,尝试另外一条,直到走出。Problem 37. Sudoku Solver:Write

2016-06-29 22:11:56 225

原创 (Leetcode)31. Next Permutation

Problem 31. Next Permutation: Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers. If such arrangement is not possible, it must

2016-06-22 21:21:48 308

原创 利用fastjson序列化对象

fastjson-version: fastjson-1.1.6.jarauthor: sherine_zjuDate: 2016/05/261.序列化一个普通对象1.1 对象定义public class JSONobject { Date time; int Pid; String activity; float x; float y; pub

2016-05-26 13:50:14 3057

原创 KMP算法

前言:解 题目 Leetcode 28 Implement strStr()时,查阅和整理了关于KMP算法的资料。 The complexity of the getnext() algorithm is O(k), where k is the length of patterns(模式串/needles)。 next数组的构建的时间复杂度是O(k) The search port

2016-05-11 20:22:13 3208

原创 (Leetcode)22. Generate Parentheses

Problem: Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. For example, given n = 3, a solution set is: “((()))”, “(()())”, “(())(

2016-05-10 14:00:17 265

原创 (Leetcode)17. Letter Combinations of a Phone Number——使用LinkedList

题目:Given a digit string, return all possible letter combinations that the number could represent. A mapping of digit to letters (just like on the telephone buttons) is given below. Input:Digit stri

2016-05-08 00:02:31 426

原创 (Leetcode)11. Container With Most Water

题目: Given n non-negative integers a1, a2, …, an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Find t

2016-05-04 21:22:53 255

原创 (Leetcode)5. Longest Palindromic Substring

Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longest palindromic substring. 寻找字符串S的最长回文子串回文串:类似abc

2016-05-04 18:36:34 265

原创 (Leetcode)7. Reverse Integer

(Leetcode)7. Reverse Integer Reverse digits of an integer. Example1: x = 123, return 321 Example2: x = -123, return -321这题的要点:int,Integer的范围: -2147483648 ~ 2147483647 一些边界值的考量,x=0,x=-2147483

2016-04-19 16:52:53 277

原创 (Leetcode)3. Longest Substring Without Repeating Characters

题目: Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for “abcabcbb” is “abc”, which the length is 3

2016-03-25 22:53:07 248

原创 jQuery为动态生成的元素添加事件

我们会使用jQuery动态地生成许多子元素。 但是我们同时希望为jQuery动态生成的子元素(#oImg)添加响应事件,这时候使用传统的方法, 往往会失败。我们需要使用delegate()函数来替代原始方法。

2016-03-16 14:34:32 3834

原创 Java Web项目相对路径

Web应用程序中java class路径:比如资源路径在原来的项目中的位置为:WebRoot/myfile/aaa.jpg 项目名称为:project那么在web程序运行时,java class中的读取该文件的相对路径为: ../webapps/project/myfile/aaa.jpg因为web程序运行时的root路径为:E:\tomcat\apache

2016-01-30 00:59:18 520

原创 (JAVA)获取图片轮廓

原始图片类型为 jpg(type:TYPE_3BYTE_BGR)1.读取图片File filepath = new File("e://shang.jpg"); //image file pathBufferedImage image = ImageIO.read(filepath); //image's read_bufferint type= image.getType();

2015-11-05 12:58:11 5251 3

转载 LaTeX新人教程,30分钟从完全陌生到基本入门

1.LaTeX软件的安装和使用方法A(自助):在MikTeX的官网下载免费的MikTeX编译包并安装。下载WinEdt(收费)或TexMaker(免费)等编辑界面软件并安装。方法B(打包):在ctex.org下载ctex套装(含MikTeX及WinEdt)哈哈这一部分当然不包含在标题的30分钟里。2.第一个文档打开WinEdt,建立一个新文档,将以下内容复制进入文档中,保存,保存类型

2015-10-21 14:18:49 718

转载 如何将github repository 部署到 github pages

如何将你的github仓库部署到github pages - 红豆依旧在 - 博客园 红豆依旧在随笔 - 20, 文章 - 0, 评论 - 192, 引用 - 0 如何将你的github仓库部署到github pages   很多时候我都在思考一个问题,我们每天遇到各种各样的问题,然后我们需要

2015-09-18 16:27:03 1219

原创 利用fastjson反序列化json为对象和对象数组

利用fastjson 将 .json文件 反序列化为 java.class 和 java.util.List

2015-08-28 20:59:11 10986 2

空空如也

空空如也

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

TA关注的人

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