- 博客(17)
- 收藏
- 关注
原创 自适应控制 PID
public override double getControlValue() { double u = controlU; double detU; double y = base.y; double SetValue = base.r; Error_K_2
2017-06-15 19:26:22
12164
3
原创 Construct Binary Tree from Inorder and Postorder Traversal
Given inorder and postorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree./** * Definition for a binary tree node. * public class
2017-06-10 17:11:22
226
原创 Construct Binary Tree from Preorder and Inorder Traversal
Given preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.本题采用递归的方式来进行:/** * Definition for a binary tree node. *
2017-06-10 17:01:20
216
原创 Binary Tree Zigzag Level Order Traversal
Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level and alternate between).For example:Given binary tr
2017-06-10 16:33:03
182
原创 Combinations
Given two integers n and k, return all possible combinations ofk numbers out of 1 ... n.For example,If n = 4 and k = 2, a solution is:[ [2,4], [3,4], [2,3], [1,2], [1,3], [1,4],]
2017-06-10 15:53:44
202
原创 Set Matrix Zeroes
Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place.click to show follow up.Follow up:Did you use extra space?A straight forward solution using O(mn) s
2017-06-10 15:42:02
152
原创 Reverse Linked List II
Reverse 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 satisfy the follo
2017-06-10 15:05:43
147
原创 Search a 2D Matrix
Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:Integers in each row are sorted from left to right.The first integer of each
2017-06-10 14:34:26
141
原创 全排列问题 java
经常会遇到字符串全排列的问题。例如:输入为{‘a’,’b’,’c’},则其全排列组合为abc,acb,bac,bca,cba,cab。对于输入长度为n的字符串数组,全排列组合为n!种。思路:从字符串数组中每次选取一个元素,作为结果中的第一个元素。然后,对剩余的元素全排列,步骤跟上面一样。很明显这是个递归处理的过程,一直到最后即可。public class Main { publi
2017-06-10 14:09:49
248
原创 Java Annotation注解
JPA简介:JPA全称Java Persistence API。JPA通过JDK5.0注解或XML描述对象——关系表的映射关系,并将运行期的实体对象持久化到数据库中。JPA的总体思想和现有Hibernate、TopLink、JDP等ORM框架大体一致。总的来说,JPA包括以下3方面的技术:(1)ORM映射元数据JPA支持XML和JDK5.0注解两种元数据的形式,元数据描述对象和
2017-03-27 21:56:04
330
原创 【Java】Java中,String、StringBuffer和StringBuilder的区别
1、StringString:字符串常量,字符串长度不可变。Java中的String是immutable(不可变)的。String类的包含如下定义: /** The value is used for character storage. */ private final char value[]; /** The offset is the
2016-12-17 20:52:10
197
原创 【Java】java嵌套类及内部类
一、什么是嵌套类及内部类 可以在一个类的内部定义一个类,这种类称为嵌套类(nested classes),它有两种类型:静态嵌套类和非静态嵌套类。静态嵌套类很少用,最重要的是非静态嵌套类,被称作内部类(inner)。其中inner类被分为三种:(1)在一个类(外部类)中直接定义的内部类;(2)在一个方法(外部类的方法)中定义的内部类;(3)匿名内部类;二、静态嵌套类
2016-12-14 20:12:42
343
原创 【MySql】检索数据SELECT语句
(1)启动数据库;(2)通过“show database;”语句显示所有的数据库,使用“use 数据库名;”进入到索要操作的数据库,使用“show tables;”进入到索要操作的数据表,使用“show columns from 数据表名;”可以显示该表包含那些列;(3)检索数据:select语句:3.1、检索单个列:select 列名 from 表名;注意:sql语句不区分大小写
2016-12-10 21:16:00
445
原创 【leetcode】Longest Common Prefix
Longest Common PrefixWrite a function to find the longest common prefix string amongst an array of strings.问题分析: (1) 对于这个问题,首先处理特殊字符串,对于[] 和[""]等字符串要优先处理,输出“”,对于字符串数组中只有一个字符串的情况,那么它自己本身就是最长
2016-12-02 11:18:06
202
原创 【leetcode】ZigZag Conversion
The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)P A H NA P L S I I
2016-12-01 22:50:57
176
原创 【leetcode】Two Sum
Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would haveexactly one solution.Example:Given nums =
2016-12-01 22:49:30
193
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人