自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(69)
  • 资源 (3)
  • 收藏
  • 关注

原创 Java使用Imageio拆分gif图片时保存的图片变为黑色

在拆分GIF图片时,遇到最后保存的图片变为黑色问题。代码如下: public static void splitGif(String filename,String path){ try{ GifDecoder decoder = new GifDecoder(); decoder.read(filename); ...

2018-08-06 14:34:20 1806

原创 Mac OS安装pandas包时遇到的问题

在终端准备使用pip install 安装pandas,但是遇到如下问题:我看是卸载numpy时报的错,就准备使用pip uninstall 去卸载numpy,但是还是没有权限,即使我使用sudo。然后我就一直百度,最后发现一个比较靠谱的博客,描述和我的问题很相似,然后使用它的方法成功了。原因就是pandas依赖numpy,安装pandas时也会安装numpy,然后系统中本来就有numpy,但是版...

2018-03-23 07:13:19 4449

原创 MacOS 安装MySQL-python

网上的方法有很多,但是按照有些方法安装时会有些错误,我通过简单命令安装时遇到如下问题:之后换了如下方法,成功安装:1. 从github下载源码: github源码2. 解压,并且修改site.cfg文件,删掉mysql_config前的注释符号‘#’,并修改其路径为mysql_config =/usr/local/mysql/bin/mysql_config 3

2018-01-15 13:23:41 479

原创 mac安装Scrapy过程以及遇到的问题

mac系统安装Scrapy

2017-12-26 15:33:24 426

原创 深度遍历(DFS)

现在有n位工程师和6项工作(编号为0至5),现在给出每个人能够胜任的工作序号表(用一个字符串表示,比如:045,表示某位工程师能够胜任0号,4号,5号工作)。现在需要进行工作安排,每位工程师只能被安排到自己能够胜任的工作当中去,两位工程师不能安排到同一项工作当中去。如果两种工作安排中有一个人被安排在的工作序号不一样就被视为不同的工作安排,现在需要计算出有多少种不同工作安排计划。 输入描

2017-08-11 23:32:07 385

原创 动态规划

题目一:现在有两个好友A和B,住在一片长有蘑菇的由n*m个方格组成的草地,A在(1,1),B在(n,m)。现在A想要拜访B,由于她只想去B的家,所以每次她只会走(i,j+1)或(i+1,j)这样的路线,在草地上有k个蘑菇种在格子里(多个蘑菇可能在同一方格),问:A如果每一步随机选择的话(若她在边界上,则只有一种选择),那么她不碰到蘑菇走到B的家的概率是多少?输入描述:

2017-08-11 23:05:45 308

原创 Java基础1---动态绑定实现机制

关于动态绑定的实现机制多态是通过动态绑定实现的。那么动态绑定是如何实现的呢?虚拟机是如何找到正确的方法呢?先看下面代码:class Father{      public void f1(){          System.out.println("father-f1()");      }          public void f1(int i){

2017-08-03 13:42:28 371

原创 LeetCode-338. Counting Bits (Java)

Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary representation and return them as an array.Example:For num = 5

2017-07-24 21:18:18 505

原创 LeetCode-257. Binary Tree Paths (Java)

Given a binary tree, return all root-to-leaf paths.For example, given the following binary tree: 1 / \2 3 \ 5All root-to-leaf paths are:["1->2->5", "1->3"]-------

2017-07-19 20:38:18 352

原创 LeetCode-367. Valid Perfect Square (Java)

Given a positive integer num, write a function which returns True if num is a perfect square else False.Note: Do not use any built-in library function such as sqrt.Example 1:Input: 16

2017-07-19 17:57:27 378

原创 LeetCode-501. Find Mode in Binary Search Tree(Java)

Given a binary search tree (BST) with duplicates, find all the mode(s) (the most frequently occurred element) in the given BST.Assume a BST is defined as follows:The left subtree of a node c

2017-07-19 16:52:19 861

原创 LeetCode-101. Symmetric Tree(Java)

Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree [1,2,2,3,4,4,3] is symmetric: 1 / \ 2 2 / \ / \3 4 4 3

2017-07-14 11:43:44 395

原创 LeetCode-198. House Robber (Java)

You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent house

2017-07-14 10:02:05 285

原创 LeetCode-27. Remove Element(Java)

Given an array and a value, remove all instances of that value in place and return the new length.Do not allocate extra space for another array, you must do this in place with constant memory.

2017-07-13 15:00:29 312

原创 LeetCode-235. Lowest Common Ancestor of a Binary Search Tree (Java)

Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST.According to the definition of LCA on Wikipedia: “The lowest common ancestor is defined betwee

2017-07-13 12:44:24 345

原创 LeetCode-83. Remove Duplicates from Sorted List (Java)

Given a sorted linked list, delete all duplicates such that each element appear only once.For example,Given 1->1->2, return 1->2.Given 1->1->2->3->3, return 1->2->3.-------------------------

2017-07-11 11:21:47 293

原创 LeetCode-107. Binary Tree Level Order Traversal II (java)

Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root).For example:Given binary tree [3,9,20,null,null,1

2017-07-11 09:52:28 400

原创 LeetCode-70. Climbing Stairs (Java)

You are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?Note: Given n will be a posi

2017-07-09 14:33:33 387

原创 LeetCode-594. Longest Harmonious Subsequence(Java)

We define a harmonious array is an array where the difference between its maximum value and its minimum value is exactly 1.Now, given an integer array, you need to find the length of its longest h

2017-07-09 11:11:57 345

原创 LeetCode-121. Best Time to Buy and Sell Stock (Java)

Say you have an array for which the ith element is the price of a given stock on day i.If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock),

2017-07-08 15:16:46 306

原创 LeetCode-572. Subtree of Another Tree (Java)

Given two non-empty binary trees s and t, check whether tree t has exactly the same structure and node values with a subtree of s. A subtree of s is a tree consists of a node in s and all of this no

2017-07-06 12:52:29 378

原创 LeetCode-415. Add Strings (Java)

Given two non-negative integers num1 and num2 represented as string, return the sum of num1 and num2.Note:The length of both num1 and num2 is Both num1 and num2 contains only digits 0-9.

2017-07-04 23:25:30 340

原创 LeetCode-108. Convert Sorted Array to Binary Search Tree(Java)

Given an array where elements are sorted in ascending order, convert it to a height balanced BST.-----------------------------------------------------------------------------------------------------

2017-07-03 10:45:47 348

原创 LeetCode-543. Diameter of Binary Tree (Java)

Given a binary tree, you need to compute the length of the diameter of the tree. The diameter of a binary tree is the length of the longest path between any two nodes in a tree. This path may or may n

2017-07-02 21:13:09 394

原创 LeetCode-551. Student Attendance Record I (Java)

You are given a string representing an attendance record for a student. The record only contains the following three characters:'A' : Absent.'L' : Late.'P' : Present.A student could be

2017-07-02 17:04:28 656

原创 LeetCode-541. Reverse String II (Java)

Given a string and an integer k, you need to reverse the first k characters for every 2k characters counting from the start of the string. If there are less than k characters left, reverse all of th

2017-07-02 00:51:33 1086

原创 LeetCode-268. Missing Number (Java)

Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array.For example,Given nums = [0, 1, 3] return 2.Note:Your algorithm sho

2017-07-01 14:37:04 306

原创 LeetCode-350. Intersection of Two Arrays II (Java)

Given two arrays, write a function to compute their intersection.Example:Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2, 2].Note:Each element in the result should appear as ma

2017-06-30 16:16:20 296

原创 LeetCode-447. Number of Boomerangs (Java)

Given n points in the plane that are all pairwise distinct, a "boomerang" is a tuple of points (i, j, k) such that the distance between i and j equals the distance between i and k (the order of

2017-06-30 13:34:17 489

原创 LeetCode-401. Binary Watch (Java)

A binary watch has 4 LEDs on the top which represent the hours (0-11), and the 6 LEDs on the bottom represent the minutes (0-59).Each LED represents a zero or one, with the least significant bit o

2017-06-29 09:56:02 459

原创 LeetCode-504. Base 7 (Java)

Given an integer, return its base 7 string representation.Example 1:Input: 100Output: "202"Example 2:Input: -7Output: "-10"----------------------------------------------------------

2017-06-28 11:22:03 526

原创 LeetCode-206. Reverse Linked List (Java)

Reverse a singly linked list.---------------------------------------------------------------------------------------------------题意反转一个链表思路反转链表总的来说有两种方式:1.递归,2.非递归代码1.非递归public class

2017-06-28 10:19:22 380

原创 LeetCode-409. Longest Palindrome (Java)

Given a string which consists of lowercase or uppercase letters, find the length of the longest palindromes that can be built with those letters.This is case sensitive, for example "Aa" is not con

2017-06-27 14:45:49 346

原创 LeetCode-217. Contains Duplicate (Java)

Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the array, and it should return false if every element

2017-06-27 11:17:38 447

原创 LeetCode-628. Maximum Product of Three Numbers (Java)

Given an integer array, find three numbers whose product is maximum and output the maximum product.Example 1:Input: [1,2,3]Output: 6Example 2:Input: [1,2,3,4]Output: 24

2017-06-27 10:02:38 1431

原创 LeetCode-242. Valid Anagram (Java)

Given two strings s and t, write a function to determine if t is an anagram of s.For example,s = "anagram", t = "nagaram", return true.s = "rat", t = "car", return false.--------------------

2017-06-26 12:16:03 290

原创 LeetCode-169. Majority Element (Java)

Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.You may assume that the array is non-empty and the majority element

2017-06-25 16:24:42 411

原创 LeetCode-237. Delete Node in a Linked List(Java)

Write a function to delete a node (except the tail) in a singly linked list, given only access to that node.Supposed the linked list is 1 -> 2 -> 3 -> 4 and you are given the third node with value

2017-06-25 12:40:25 353

原创 LeetCode-100. Same Tree (Java)

Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical and the nodes have the same value.----------

2017-06-25 11:47:39 422

原创 LeetCode-387. First Unique Character in a String (Java)

Given a string, find the first non-repeating character in it and return it's index. If it doesn't exist, return -1.Examples:s = "leetcode"return 0.s = "loveleetcode",return 2.Note: You ma

2017-06-25 09:58:48 476

saveImage.rar

实现图片存入数据库,然后查询图片显示在界面

2013-09-05

俄罗斯方块

儿时最爱玩的小游戏,想知道是怎么编写的么?

2012-03-31

c语言游戏代码

几种比较有趣的游戏代码,推箱子,娱乐外也可以学习

2012-03-31

空空如也

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

TA关注的人

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