- 博客(275)
- 资源 (3)
- 收藏
- 关注

原创 5分钟学会Lua编程(简明教程)
关键字:and break do else elseif end false goto for function if in local nil not or repeat return then true until while标识符有字母,数字,下划线组成,非数字开头,_这个标识符Lua特意留给用户使用。
2016-11-23 17:15:18
7345
原创 四大美女之一王昭君
王昭君王昭君,名嫱,字昭君,乳名皓月, 西汉南郡秭归人, 今湖北省宜昌市兴山县人。汉元帝建昭元年,下诏征集天下美女补充后宫,王昭君年当二八,仿如空谷幽兰,自然被选入宫。从全国各地挑选入宫的美女数以千计,皇帝无法一一见面,首先由画工毛延寿各画肖像一幅呈奉御览。出生富贵的人家,就贿赂毛延寿,而王昭君自恃美冠群芳,也无力贿赂,就不行贿毛延寿,这让毛延寿很不满,于是就把王昭君画的丑
2017-09-04 00:43:11
2935
原创 Leetcode551. Student Attendance Record I一趟遍历
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 21:58:24
1040
原创 Leetcode628. Maximum Product of Three Numbers不要太简单
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-07-02 21:48:47
1220
1
原创 LeetCode53. Maximum Subarray一种很好的做法
Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array [-2,1,-3,4,-1,2,1,-5,4],the contiguous subarray [4,-1,2,1] ha
2017-06-30 17:25:05
831
原创 SVN报错“Previous operation has not finished; run 'cleanup' if it was interrupted”的解决方法
百试不爽的解决方法1. 网上可以下到sqlite-shell-win32-x86: sqlite3.exe2.将sqlite3.exe放到svn 项目的主目录下,和.svn目录同级下。3.执行 sqlite3 .svn/wc.db "select * from work_queue" ,可以看到操作记录4.执行 sqlite3 .svn/wc.db "delete fr
2017-05-22 20:52:39
1201
原创 C#文件读写追加创建目录,判断目录是否存在等操作
using System;using System.Collections.Generic;using System.IO;using System.Linq;using System.Text;using System.Threading.Tasks;namespace FundData{ static class FileUtil { publi
2017-04-27 23:01:10
1245
原创 C#多线程实例清晰易懂
using System;using System.Threading;public class Fibonacci{ private int _n; private int _fibOfN; private ManualResetEvent _doneEvent; public int N { get { return _n; } } pub
2017-04-27 22:57:05
1342
原创 LeetCode347. Top K Frequent Elements【map+priority_queue解法】
Given a non-empty array of integers, return the k most frequent elements.For example,Given [1,1,1,2,2,3] and k = 2, return [1,2].Note: You may assume k is always valid, 1 ≤ k ≤ number
2017-04-03 21:07:27
741
原创 优先队列priority_queue的使用
#include #include #include using my_pair_t = std::pair;using my_container_t = std::vector;void test_priority_queue(){auto my_comp = [](const my_pair_t e1, const my_pair_t& e2){
2017-04-03 19:51:56
838
原创 LeetCode530. Minimum Absolute Difference in BST中序遍历真神奇
Given a binary search tree with non-negative values, find the minimum absolute difference between values of any two nodes.Example:Input: 1 \ 3 / 2Output:1Explanation:
2017-03-31 22:17:10
783
原创 LeetCode541. Reverse String II小学生都会
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-03-30 22:05:40
831
原创 LeetCode504. Base 7 我是如何解答的
Given an integer, return its base 7 string representation.Example 1:Input: 100Output: "202"Example 2:Input: -7Output: "-10"Note: The input will be in range of [-1e7, 1e
2017-03-30 21:28:01
781
原创 LeetCode520. Detect Capital有那么难解吗
Given a word, you need to judge whether the usage of capitals in it is right or not.We define the usage of capitals in a word to be right when one of the following cases holds:All letters in t
2017-03-28 21:44:12
577
原创 LeetCode415. Add Strings小学生都会
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-02-12 22:47:16
590
原创 Leetcode506. Relative Ranks简单粗暴
Given scores of N athletes, find their relative ranks and the people with the top three highest scores, who will be awarded medals: "Gold Medal", "Silver Medal" and "Bronze Medal".class Solution
2017-02-11 22:16:29
989
原创 LeetCode496. Next Greater Element I使用map解答
You are given two arrays (without duplicates) nums1 and nums2 where nums1’s elements are subset of nums2. Find all the next greater numbers for nums1's elements in the corresponding places of nums
2017-02-08 23:59:43
851
原创 LeetCode500. Keyboard Row我的C++解法
Given a List of words, return the words that can be typed using letters of alphabet on only one row's of American keyboard like the image below.Example 1:Input: ["Hello", "Alaska",
2017-02-07 22:41:18
1286
原创 Leetcode501. Find Mode in Binary Search Tree大道至简
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 contains onl
2017-02-06 15:53:52
1708
原创 LeetCode447. Number of Boomerangs时间复杂度O(N2)
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 the tup
2017-02-05 17:20:30
547
原创 Leetcode350. Intersection of Two Arrays II很简单的做法
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-02-04 17:14:29
404
原创 Leetcode492. Construct the Rectangle最简洁解法
For a web developer, it is very important to know how to design a web page's size. So, given a specific rectangular web page’s area, your job by now is to design a rectangular web page, whose length L
2017-02-04 11:43:38
747
原创 LeetCode485. Max Consecutive Ones有你真好
Given a binary array, find the maximum number of consecutive 1s in this array.Example 1:Input: [1,1,0,1,1,1]Output: 3Explanation: The first two digits or the last three digits are consecutiv
2017-01-19 20:40:37
525
原创 LeetCode476. Number Complement位操作面试题
Given a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation.Note:The given integer is guaranteed to fit within the range
2017-01-14 23:42:26
490
原创 LeetCode453. Minimum Moves to Equal Array Elements我是这么解答的
Given a non-empty integer array of size n, find the minimum number of moves required to make all array elements equal, where a move is incrementing n - 1 elements by 1.Example:Input:[1,2,3]Ou
2017-01-08 23:32:52
331
原创 C#编程命名规范
这盛世,如你所愿。每当看到一些混蛋的官员言论,内心挺愤怒的,即痛恨这种混蛋,也痛恨自己无能为力。命名约定:在.NET Framework名称空间中有两种命名约定,称为PascalCase和camelCase在camelCase中,有一个规则,如果多个单词命名变量名,从第二个单词开始,每个单词首字母大写命名规则:命名空间、类、常量等的名称都遵循Pascal规则!
2017-01-08 23:06:31
385
原创 LeetCode448. Find All Numbers Disappeared in an Array新年第一篇
Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once.Find all the elements of [1, n] inclusive that do not appear in this array.
2017-01-01 11:00:55
347
原创 LeetCode455. Assign Cookies简单的做法
Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie. Each child i has a greed factor gi, which is the minimum size of a c
2016-12-31 11:28:29
449
2
原创 Leetcode461. Hamming Distance不要太简单哦
The 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,
2016-12-23 10:40:18
2463
原创 463. 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 completel
2016-12-20 10:32:24
432
原创 用Irony实现一个计算器附上源码
满足的功能如下:加减乘除四则运算括号优先级比如:3+2*4 - 8/4 的结果是92* (2 + 3) - 2的结果是8Irony是.net平台下实现语言的开发工具箱。作者把C#这种强大的现代语言引入编译器解析领域,语法规则直接通过C#语言来描述。下面看看这个计算器的语法是怎么写的:Terminal num = new NumberLiteral
2016-12-15 10:19:38
721
原创 关于C#的virtual,Override和new的坑
先看这么一段代码: public class Base { public virtual void DoWork( int a) { Console.WriteLine( "base dowork"); } } public class Derived : Base { public overri
2016-12-14 10:18:16
429
原创 比尔盖茨给年轻人的14条建议
Some rules kids won't learn in school Text By Charles J. Sykes Printed in San Diego Union Tribune September 19, 1996
2016-12-13 14:37:15
1733
原创 大数相乘
local bignum = {}function bignum.len(num) return string.len(num)endfunction bignum.splitAt(num, pos) local low = string.sub(num, -pos) local high = string.sub(num, 1, -pos
2016-11-25 18:42:00
487
原创 大数big number的加减运算
以下是Lua的实现:function plus(str1, str2) local increase = 0 local t = {} local max = math.max(string.len(str1), string.len(str2)) for i = 0, max-1 do local ch1 = string.sub(s
2016-11-25 14:37:34
6120
原创 LeetCode 401. Binary Watch
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
2016-10-29 16:53:58
437
原创 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-10-15 22:08:40
871
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人