自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(58)
  • 收藏
  • 关注

原创 SQLite/sharePreference可视化工具

1.SQLite 数据库可视化工具推荐SQLiteStudio 下载地址 https://sqlitestudio.pl/index.rvt1.打开Android studio,tools下的ADM工具 2.导出.db文件到电脑(导出按钮在右上角) 3.将文件导入SQLiteStudio即可视(点击要查看的表,选择上方“数据”列,默认显示的是“结构”列,不显示数据) 2.SQLite /sh

2017-06-15 21:55:04 1820

原创 android自定义view之加载动画ColorBall

更多细节请看源码 https://github.com/que123567/CradleBallView1.自定义类CradleBall继承自View即:画一个小球public class CradleBall extends View { public CradleBall(Context context) { super(context); } public C

2017-06-01 12:35:51 1394

原创 android自定义view之九宫格解锁

android自定义view之九宫格解锁更多细节请看源码 https://github.com/que123567/lockview1. 定义一个类作为九宫格的格子包含坐标和索引(用来记录密码) point含三种状态分别对应三种不同情况下点的图片样式package lockview;/** * Created by smaug on 2017/5/11. */public class P

2017-05-31 18:52:01 1452

原创 [LeetCode461]Hamming Distance

he Hamming distance between two integers is the number of positions at which the corresponding bits are different.Given two integers x and y, calculate the Hamming distance.Note:0 ≤ x, y

2017-02-20 12:08:12 650

原创 [LeetCode] Single Number By java

371. Sum of Two Integers Add to ListQuestionEditorial Solution My SubmissionsTotal Accepted: 48757Total Submissions: 94704Difficulty: EasyContributors: AdminC

2016-12-13 14:24:15 504

原创 [LeetCode463]Island Perimeter岛屿周长问题

You are given a map in form of a two-dimensional integer grid where 1 represents land and 0 represents water. Grid cells are connected horizontally/vertically (not diagonally). The grid is completely

2016-12-12 20:22:25 762

原创 [leetCode] Reversing String

Write a function that takes a string as input and returns the string reversed.Example:Given s = "hello", return "olleh".Subscribe to see which companies asked this questionpublic S

2016-12-11 13:37:49 603

原创 [LeetCode412] Fizz Buzz

Write a program that outputs the string representation of numbers from 1 to n.But for multiples of three it should output “Fizz” instead of the number and for the multiples of five output “Buzz”.

2016-12-11 09:52:11 483

原创 [LeetCode 16] 3Sum Closest

Title:Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input would

2016-07-13 15:26:09 755

原创 [leetcode 1]TwoSum

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 have exactly one solution.Example:Given nums =

2016-06-04 10:30:46 602

原创 [leetcode 128]Longest consecutive sequence

Given an unsorted array of integers, find the length of the longest consecutive elements sequence.For example,Given [100, 4, 200, 1, 3, 2],The longest consecutive elements sequence is [1, 2, 3

2016-06-04 10:21:48 541

原创 [LeetCode26] Remove Duplicates from Sorted Array

作为LeetCode:80的先导题,不会做80的先看这题。Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.Do not allocate extra space for another ar

2016-06-01 18:56:28 838

原创 [LeetCode 80]Remove Duplicates from Sorted Array II

Follow up for "Remove Duplicates":What if duplicates are allowed at most twice?For example,Given sorted array nums = [1,1,1,2,2,3],Your function should return length = 5, with the first fi

2016-06-01 18:53:55 634

原创 [LeetCode] Ugly Number

题目描述:Write a program to check whether a given number is an ugly number.Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 6, 8 are ugly while 14 is not ug

2016-05-06 15:45:35 613

原创 [LeetCode28]

字符串匹配:Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.Subscribe to see which companies asked this question

2016-05-06 15:09:56 687

原创 [LeetCode 58]Length of Last Word

Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string.If the last word does not exist, return 0.Note: A word is

2016-05-04 19:32:01 459

原创 [LeetCode 151] Reverse Words in a String

Given an input string, reverse the string word by word.For example,Given s = "the sky is blue",return "blue is sky the".语言使用python:整体思路:使用spilit()函数把以空格区分的字符串列表分割 然后倒置列表,最后写入字符串中并且添加空格

2016-04-25 16:35:11 382

原创 [LeetCode 338] Counting Bits

LeetCode 338. Counting BitsGiven 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 ar

2016-04-24 13:24:12 527

原创 [LeetCode 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 without division

2016-04-04 15:48:56 550

原创 [LeetCode 7] Reverse Integer

题目:Reverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321我自己的代码,有点混乱而且没有考虑溢出情况,没有AC;int reverse(int x) { int length = 0; int res[32], resul

2016-04-03 15:12:10 400

原创 LeetCode 82 Remove Duplicates from Sorted List II

题目:Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list.For example,Given 1->2->3->3->4->4->5, return 1->2->5.Gi

2016-04-02 21:59:08 222

原创 LeetCode 83 Remove Duplicates from Sorted List

题目: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->3AC不过,但是经过自己代码测试发现

2016-04-02 15:43:03 242

原创 [LeetCode 326] Power of Three

题目:Given an integer, write a function to determine if it is a power of three.Follow up:Could you do it without using any loop / recursion?(更进一步,是否能不使用循环和递归)递归做法:bool isPowerOfThree

2016-04-01 16:15:38 292

原创 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

2016-04-01 15:34:18 217

原创 Leetcode 169 Majority Element

题目: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

2016-03-30 19:05:08 207

原创 LeetCode 217 Contains Duplicate

题目: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 eleme

2016-03-30 17:49:10 286

原创 LeetCode 231 Power of Two(三解)

231. Power of TwoGiven an integer, write a function to determine if it is a power of two.我的方法是暴力求解,循环让1一直乘以2,如果结果等于n,且n大于0则输出true。这是最容易想到的方法class Solution {public: bool isPowerOfTwo(int

2016-03-28 23:37:34 298

原创 LeetCode 191 number of 1 bits

Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as the Hamming weight).For example, the 32-bit integer ’11' has binary representation 000000

2016-03-28 23:17:37 273

原创 Leetcode 120 Triangle(图解)

Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent(相邻的) numbers on the row below.For example, given the following triangle[ [2], [3,4],

2016-03-26 10:40:36 433

原创 算法导论 动态规划之钢条切割

#include#includeusing namespace std;int UpToBottom(int *p,int n)//普通的自顶向下实现{ if (n == 0) return 0; int q = -1; for (int i = 1; i <= n; i++) { q = max(q, p[i]+UpToBottom(p, n - i)); } re

2016-03-25 13:47:02 524

原创 LeetCode137 Single Number II

question:Given an array of integers, every element appears three times except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement i

2016-03-21 10:16:00 279

原创 LeetCode 202 Happy number

Write an algorithm to determine if a number is "happy".A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of the squares

2016-03-16 19:59:12 350

原创 LeetCode 258. Add Digits

Given a non-negative integer num, repeatedly add all its digits until the result has only one digit.For example:Given num = 38, the process is like: 3 + 8 = 11, 1 + 1 = 2. Since 2 has on

2016-03-15 22:15:31 299

原创 LeetCode 136 single number

题目:给定一个数组,每个元素都出现2次除了其中的一个,找出只出现一次的数字注意:算法必须是线性时间复杂度,不使用额外的空间。提示:利用亦或运算的性质。#include#includeusing namespace std;int single(vector&num){//A XOR A =0; int result = 0; for (int i = 0; i != num

2016-03-14 21:01:41 218

原创 Leetcode266 Palindrome Permutation

QuestionGiven a string, determine if a permutation of the string could form a palindrome.For example, “code” -> False, “aab” -> True, “carerac” -> True.Hint:Consider the palindromes

2016-03-14 11:32:45 314

翻译 Uva 10474

#include //lower_bound 查找大于或者等于X的第一个位置(返回地址)#includeusing namespace std;const int maxn = 1000;int main(){ int n, q, x, a[maxn], kase = 0; while (scanf("%d%d",&n,&q) == 2 && n) { cout << "Ca

2016-02-27 21:32:26 285

原创 Uva201 Squares

*未按照题目的格式。/*整体思路:枚举法,扫描全部的点,用size代表每次检查的正方形边长,依次检查是否满足题意*/#includeusing namespace std;int H[10][10];int V[10][10];void Edge(char Edge,int i,int j){ if (Edge == 'H'){ H[i][j] = 1; } if (

2016-02-06 18:52:31 263

原创 Uva133 约瑟夫圆环新解

之前学数据结构遇到双向循环列表,现在发现一种更简便的方法解决类似约瑟夫圆环问题。 #includeusing namespace std;int n,k,m ,a[25];int go(int p, int d, int t){ while (t--){ do{ p = (p + d +n - 1) % n + 1; } while (a[p] == 0); } re

2016-02-04 20:28:25 536

原创 Uva1588

/*Page 59 3-11 齿轮啮合 */#include using namespace std;int main(){ char Up[100], Down[100]; while (scanf("%s%s", Up, Down) != EOF) { int Length1 = 0, Length2 = 0; //不同移动方向产生的长度 int memory = 0; /

2016-02-04 12:49:28 507

原创 Uva10340

#include #includeusing namespace std;int main(){ int score = 0; string s, t; cin >> s >> t; for (int i = 0; i < s.size(); i++){ for (int j = score; j < t.size(); j++) { if (s[i] ==

2016-02-03 20:04:56 353

空空如也

空空如也

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

TA关注的人

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