![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
java
zyaphone
这个作者很懒,什么都没留下…
展开
-
LintCode:乘积最大子序列
LintCode:乘积最大子序列Pythonclass Solution: # @param nums: an integer[] # @return: an integer def maxProduct(self, nums): # write your code here if len(nums) == 0: ret原创 2016-05-10 17:18:45 · 385 阅读 · 0 评论 -
LintCode:旋转图像
LintCode:旋转图像public class Solution { /** * @param matrix: A list of lists of integers * @return: Void */ public void rotate(int[][] matrix) { // write your code here原创 2016-07-27 21:09:34 · 225 阅读 · 0 评论 -
LintCode:O(1)时间检测2的幂次
LintCode:O(1)时间检测2的幂次class Solution { /* * @param n: An integer * @return: True or false */ public boolean checkPowerOf2(int n) { // write your code here if(n <=0原创 2016-07-27 22:20:15 · 476 阅读 · 0 评论 -
LintCode:将整数A转换为B
LintCode:将整数A转换为BJavaclass Solution { /** *@param a, b: Two integer *return: An integer */ public static int bitSwapRequired(int a, int b) { // write your code here原创 2016-07-31 16:03:26 · 261 阅读 · 0 评论 -
Java:JDBC连接数据库
package tk.bigfeng.www;import java.sql.Connection;import java.sql.DriverManager;import java.sql.SQLException;import java.sql.*;import com.mysql.jdbc.PreparedStatement;public class SqlDemo { sta原创 2016-08-15 23:35:03 · 264 阅读 · 0 评论 -
LintCode:实现 Trie
LintCode:实现 Trie参考地址:百度百科–字典树Java/** * Your Trie object will be instantiated and called as such: * Trie trie = new Trie(); * trie.insert("lintcode"); * trie.search("lint"); will return false * tri原创 2016-07-25 22:56:11 · 374 阅读 · 0 评论 -
LintCode:区间求和
LintCode:区间求和暴力求解,超时。。。"""Definition of Interval.class Interval(object): def __init__(self, start, end): self.start = start self.end = end"""class Solution: """ @param原创 2016-08-13 00:10:37 · 601 阅读 · 0 评论 -
LintCode:区间求和 II
LintCode:区间求和 II class SegmentTreeNode { public int start, end; long max; public SegmentTreeNode left, right; public SegmentTreeNode(int start, int end, long max) { t原创 2016-08-13 17:44:35 · 528 阅读 · 0 评论 -
LintCode:统计比给定整数小的数的个数
LintCode:统计比给定整数小的数的个数尝试用线段树,超时。public class Solution { /** * @param A: An integer array * @return: The number of element in the array that * are smaller that the given inte原创 2016-08-14 01:04:59 · 675 阅读 · 0 评论 -
LintCode:完美平方
LintCode:完美平方public class Solution { /** * @param n a positive integer * @return an integer */ public int numSquares(int n) { // Write your code here int[] dp = n原创 2016-09-06 00:21:55 · 912 阅读 · 1 评论 -
itchat4j -- 用Java扩展个人微信号的能力
### 项目地址:itchat4j,该项目长期维护更新,欢迎star、fork、 pull requests、 issue。来源itchat是一个非常优秀的开源微信个人号接口,使用Python语言开发,提供了简单易用的API,可以很方便地对个人微信号进行扩展,实现自动回复,微信挂机机器人等,一直在关注这个项目,基于itchat开发过一个小项目,用来控制我的树莓派来播放音乐,效果还不错。一直想实现一个原创 2017-04-30 02:02:29 · 14356 阅读 · 20 评论 -
itchat4j -- 用Java扩展个人微信号的能力
itchat4j – 用Java扩展个人微信号的能力项目地址:itchat4j,该项目长期维护更新,欢迎star、fork、 pull requests、 issue。来源itchat是一个非常优秀的开源微信个人号接口,使用Python语言开发,提供了简单易用的API,可以很方便地对个人微信号进行扩展,实现自动回复,微信挂机机器人等,一直在关注这个项目,基于itchat开发过一个小项目,用来控制我的原创 2017-05-14 22:08:08 · 4227 阅读 · 1 评论 -
Lintcode:数飞机
LintCode:数飞机Java/** * Definition of Interval: * public classs Interval { * int start, end; * Interval(int start, int end) { * this.start = start; * this.end = end; *原创 2016-06-07 16:46:44 · 376 阅读 · 0 评论 -
LintCode:带最小值操作的栈
LintCode:带最小值操作的栈Pythonclass MinStack(object): def __init__(self): # do some intialize if necessary self.stack = [] def push(self, number): # write yout code here原创 2016-05-13 16:11:27 · 716 阅读 · 0 评论 -
LintCode:用栈实现队列
LintCode:用栈实现队列Pythonclass MyQueue: def __init__(self): self.stack1 = [] self.stack2 = [] def push(self, element): # write your code here self.stack1.append(elemen原创 2016-05-13 14:51:35 · 328 阅读 · 0 评论 -
LintCode:买卖股票的最佳时机 II
LintCode:买卖股票的最佳时机 II贪心算法,只要后一天的价格大于前一天的价格就买入。Pythonclass Solution: """ @param prices: Given an integer array @return: Maximum profit """ def maxProfit(self, prices): # writ原创 2016-05-10 18:24:26 · 402 阅读 · 0 评论 -
LintCode: 将二叉树拆成链表
LintCode: 将二叉树拆成链表Python"""Definition of TreeNode:class TreeNode: def __init__(self, val): this.val = val this.left, this.right = None, None"""class Solution: # @param root:原创 2016-05-10 19:17:09 · 999 阅读 · 0 评论 -
LintCode: 矩阵归零
LintCode: 矩阵归零Pythonclass Solution: """ @param matrix: A list of lists of integers @return: Nothing """ def setZeroes(self, matrix): # write your code here row = []原创 2016-05-10 19:54:22 · 721 阅读 · 0 评论 -
LintCode:空格替换
LintCode:空格替换注意事项如果使用 Java 或 Python, 程序中请用字符数组表示字符串。Python方法一:这个方法没有使用字符数组,直接使用的字符串数组,虽然能通过,但是不符合要求,看方法2吧。class Solution: # @param {char[]} string: An array of Char # @param {int} length: The t原创 2016-05-10 22:06:56 · 930 阅读 · 0 评论 -
LintCode:落单的数 III
LintCode:落单的数 IIIPythonclass Solution: """ @param A : An integer array @return : Two integer """ def singleNumberIII(self, A): # write your code here A = sorted(A)原创 2016-05-10 22:34:22 · 397 阅读 · 0 评论 -
LintCode:中位数
LintCode:中位数Pythonclass Solution: """ @param nums: A list of integers. @return: An integer denotes the middle number of the array. """ def median(self, nums): # write your c原创 2016-05-11 14:16:52 · 1307 阅读 · 0 评论 -
LintCode:Swap Two Nodes in Linked List
LintCode:Swap Two Nodes in Linked List# Definition for singly-linked list.# class ListNode:# def __init__(self, x):# self.val = x# self.next = Noneclass Solution: # @param {原创 2016-05-11 16:05:16 · 446 阅读 · 0 评论 -
LintCode:二叉树的层次遍历
LintCode:二叉树的层次遍历方法一:二叉树的层序遍历,需要借助两个栈空间。"""Definition of TreeNode:class TreeNode: def __init__(self, val): self.val = val self.left, self.right = None, None""""""Definition of原创 2016-05-11 18:27:11 · 502 阅读 · 1 评论 -
LintCode:线段树的查询
LintCode:线段树的查询"""Definition of SegmentTreeNode:class SegmentTreeNode: def __init__(self, start, end, max): self.start, self.end, self.max = start, end, max self.left, self.right原创 2016-05-11 20:57:38 · 341 阅读 · 0 评论 -
LintCode:最长上升子序列
LintCode:最长上升子序列LIS转化为LCS问题,动态规划。Pythonclass Solution: """ @param nums: The integer array @return: The length of LIS (longest increasing subsequence) """ def longestIncreasingSubseq原创 2016-05-11 21:46:10 · 290 阅读 · 0 评论 -
LintCode:旋转字符串
LintCode:旋转字符串Pythonclass Solution: # @param s: a list of char # @param offset: an integer # @return: nothing def rotateString(self, s, offset): # write you code here i原创 2016-05-12 00:28:59 · 655 阅读 · 0 评论 -
itchat4j -- 用Java扩展个人微信号的能力
itchat4j – 用Java扩展个人微信号的能力项目地址:itchat4j,该项目长期维护更新,欢迎star、fork、 pull requests、 issue。来源itchat是一个非常优秀的开源微信个人号接口,使用Python语言开发,提供了简单易用的API,可以很方便地对个人微信号进行扩展,实现自动回复,微信挂机机器人等,一直在关注这个项目,基于itchat开发过一个小项目,用来控制我的原创 2017-05-14 22:13:10 · 5763 阅读 · 3 评论