diff --git a/BitManipulation/BitManipulation.sln b/BitManipulation/BitManipulation.sln new file mode 100644 index 0000000..83182a3 --- /dev/null +++ b/BitManipulation/BitManipulation.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BitManipulation", "BitManipulation\BitManipulation.csproj", "{A76A4397-9B1C-4741-A344-F1080C9BB26B}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x86 = Debug|x86 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {A76A4397-9B1C-4741-A344-F1080C9BB26B}.Debug|x86.ActiveCfg = Debug|x86 + {A76A4397-9B1C-4741-A344-F1080C9BB26B}.Debug|x86.Build.0 = Debug|x86 + {A76A4397-9B1C-4741-A344-F1080C9BB26B}.Release|x86.ActiveCfg = Release|x86 + {A76A4397-9B1C-4741-A344-F1080C9BB26B}.Release|x86.Build.0 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/BitManipulation/BitManipulation.suo b/BitManipulation/BitManipulation.suo new file mode 100644 index 0000000..3c01ad4 Binary files /dev/null and b/BitManipulation/BitManipulation.suo differ diff --git a/BitManipulation/BitManipulation/BitManipulation.csproj b/BitManipulation/BitManipulation/BitManipulation.csproj new file mode 100644 index 0000000..ab5193c --- /dev/null +++ b/BitManipulation/BitManipulation/BitManipulation.csproj @@ -0,0 +1,60 @@ + + + + Debug + x86 + 8.0.30703 + 2.0 + {A76A4397-9B1C-4741-A344-F1080C9BB26B} + Exe + Properties + BitManipulation + BitManipulation + v4.0 + Client + 512 + + + x86 + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + x86 + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/BitManipulation/BitManipulation/BitManipulation.csproj.user b/BitManipulation/BitManipulation/BitManipulation.csproj.user new file mode 100644 index 0000000..55f44b9 --- /dev/null +++ b/BitManipulation/BitManipulation/BitManipulation.csproj.user @@ -0,0 +1,6 @@ + + + + ShowAllFiles + + \ No newline at end of file diff --git a/BitManipulation/BitManipulation/HammingDistanceSln.cs b/BitManipulation/BitManipulation/HammingDistanceSln.cs new file mode 100644 index 0000000..f753f61 --- /dev/null +++ b/BitManipulation/BitManipulation/HammingDistanceSln.cs @@ -0,0 +1,38 @@ +/* ============================================================================== + * 功能描述:HammingDistanceSln + * 创 建 者:gz + * 创建日期:2017/6/1 12:51:10 + * ==============================================================================*/ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.Specialized; +using System.ComponentModel; +using System.Linq; +using System.Text; + +namespace BitManipulation +{ + /// + /// HammingDistanceSln + /// + public class HammingDistanceSln + { + public int HammingDistance(int x, int y) + { + //a and y are different bits, so we think the XOR + //think:0001(1D) + // 0100(4D) + //xor = 0101(1D^4D) + int dist = 0, xor = x ^ y; + while (xor > 0) + { + //xor & (xor-1): it sets the rightest 1 bit to 0 bit of xor. + ++dist; + xor = xor & (xor - 1); + } + return dist; + } + + } +} diff --git a/BitManipulation/BitManipulation/IntegerReplacement.cs b/BitManipulation/BitManipulation/IntegerReplacement.cs new file mode 100644 index 0000000..b38c7ef --- /dev/null +++ b/BitManipulation/BitManipulation/IntegerReplacement.cs @@ -0,0 +1,37 @@ +namespace BitManipulation +{ +// Given a positive integer n and you can do operations as follow: + +// If n is even, replace n with n/2. +// If n is odd, you can replace n with either n + 1 or n - 1. +// What is the minimum number of replacements needed for n to become 1? + public class Solution + { + // Following coding refers to + // A couple of Java solutions with explanations + // But it has a bug of overflowing and I fix it. + public int IntegerReplacement(int n) { + int cnt = 0; + long bign = (long)n; //n = Int32.MaxValue(2147483647),adds 1 and would overflow + while (bign != 1) { + if ((bign & 1) == 0) { //even number + bign >>= 1; + } + //It is enough to examine the last two digits to figure out + //whether incrementing or decrementing will give more 1's. Indeed, + //if a number ends with 01, + //then certainly decrementing is the way to go. Otherwise, if it ends with 11, + //then certainly incrementing is at least as good as decrementing (*011 -> *010 / *100) or + // even better (if there are three or more 1's). + else if (bign == 3|| ((bign >> 1) & 1) == 0) { //*01 + --bign; + } + else { //*11 + ++bign; + } + ++cnt; + } + return cnt; + } + } +} diff --git a/BitManipulation/BitManipulation/NumberComplementSln.cs b/BitManipulation/BitManipulation/NumberComplementSln.cs new file mode 100644 index 0000000..b3d7aa2 --- /dev/null +++ b/BitManipulation/BitManipulation/NumberComplementSln.cs @@ -0,0 +1,30 @@ +/* ============================================================================== + * 功能描述:NumberComplementSln + * 创 建 者:gz + * 创建日期:2017/6/2 13:48:57 + * ==============================================================================*/ +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +using System.Text; + +namespace BitManipulation +{ + /// + ///#476 NumberComplementSln + /// + public class NumberComplementSln + { + public int FindComplement(int num) + { + int bits = 1; //num including bits + while (Math.Pow(2, bits) <= num) + bits++; + int sum = (int) Math.Pow(2, bits) - 1;//sum =Pow(2,n)-1: sum of n bits 1 + return sum - num; //sum - num is the complement + + } + + } +} diff --git a/BitManipulation/BitManipulation/PowOfFourSln.cs b/BitManipulation/BitManipulation/PowOfFourSln.cs new file mode 100644 index 0000000..3c05083 --- /dev/null +++ b/BitManipulation/BitManipulation/PowOfFourSln.cs @@ -0,0 +1,20 @@ +namespace BitManipulation +{ + // Given an integer (signed 32 bits), write a function to check whether it is a power of 4. + + // Example: + // Given num = 16, return true. Given num = 5, return false. + + // Follow up: Could you solve it without loops/recursion? + public class Solution + { + public bool IsPowerOfFour(int num) + { + //4d: 0010Binary 3d: 1100 0010 & 1100 = 0 + //16d:00001 15d: 11110 00001 & 11110 = 0 + return (num & (num - 1)) == 0 && (num & 0x55555555) != 0; + //0x55555555 is to remove those power of 2 but not power of 4 + //so that the value 1 always appears at the odd index + } + } +} diff --git a/BitManipulation/BitManipulation/Program.cs b/BitManipulation/BitManipulation/Program.cs new file mode 100644 index 0000000..6c38360 --- /dev/null +++ b/BitManipulation/BitManipulation/Program.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace BitManipulation +{ + class Program + { + static void Main(string[] args) + { + NumberComplementSln sln = new NumberComplementSln(); + int n = sln.FindComplement(6); + } + } +} diff --git a/BitManipulation/BitManipulation/Properties/AssemblyInfo.cs b/BitManipulation/BitManipulation/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..cfcad9f --- /dev/null +++ b/BitManipulation/BitManipulation/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 有关程序集的常规信息通过以下 +// 特性集控制。更改这些特性值可修改 +// 与程序集关联的信息。 +[assembly: AssemblyTitle("BitManipulation")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("BitManipulation")] +[assembly: AssemblyCopyright("Copyright © 2017")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// 将 ComVisible 设置为 false 使此程序集中的类型 +// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, +// 则将该类型上的 ComVisible 特性设置为 true。 +[assembly: ComVisible(false)] + +// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID +[assembly: Guid("546e7a79-26a4-4469-9861-5cb5cf74b775")] + +// 程序集的版本信息由下面四个值组成: +// +// 主版本 +// 次版本 +// 内部版本号 +// 修订号 +// +// 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值, +// 方法是按如下所示使用“*”: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Details.md b/Details.md new file mode 100644 index 0000000..792cf35 --- /dev/null +++ b/Details.md @@ -0,0 +1,201 @@ +## Details +## Array +|Number| Title(Blog URL)| +|------|-------| +35 |[Search Insert Position](http://blog.csdn.net/daigualu/article/details/66995617) +118| [Pascal's Triangle](http://blog.csdn.net/daigualu/article/details/67006388) +119 |[Pascal's Triangle II](http://blog.csdn.net/daigualu/article/details/67069088) +414| [Third Maximum Number](http://blog.csdn.net/daigualu/article/details/68063481) +121| [Best Time to Buy and Sell Stock](http://blog.csdn.net/daigualu/article/details/71038726) +66| [Plus One](http://blog.csdn.net/daigualu/article/details/71056697) +26 |[Remove Duplicates from Sorted Array](http://blog.csdn.net/daigualu/article/details/71064545) +27| [Remove Element](http://blog.csdn.net/daigualu/article/details/71104482) +122 |[Best Time to Buy and Sell Stock II](http://blog.csdn.net/daigualu/article/details/71104584) +268 |[Missing Number](http://blog.csdn.net/daigualu/article/details/69220202) +217| [Contains Duplicate](http://blog.csdn.net/daigualu/article/details/71123673) +532| [K-diff Pairs in an Array](http://blog.csdn.net/daigualu/article/details/71129806) +189| [Rotate Array](http://blog.csdn.net/daigualu/article/details/71159419) +169 |[Majority Element](http://blog.csdn.net/daigualu/article/details/69937729) +167 |[Two Sum II - Input array is sorted](http://blog.csdn.net/daigualu/article/details/69787679) +88 |[Merge Sorted Array](http://blog.csdn.net/daigualu/article/details/69367334) +53 |[Maximum Subarray](http://blog.csdn.net/daigualu/article/details/69936974) +485 |[Max Consecutive Ones](http://blog.csdn.net/daigualu/article/details/71216338) +283 |[Move Zeroes](http://blog.csdn.net/daigualu/article/details/69329038) +448 |[Find All Numbers Disappeared in an Array](http://blog.csdn.net/daigualu/article/details/71168875) +1| [Two Sum](http://blog.csdn.net/daigualu/article/details/68957096) +219 |[Contains Duplicate II](http://blog.csdn.net/daigualu/article/details/71166985) +566| [Reshape the Matrix](http://blog.csdn.net/daigualu/article/details/71275325) +561| [Array Partition I](http://blog.csdn.net/daigualu/article/details/71273279) + +--- + +## Hash Table +|Number| Title(Blog URL)| +|------|-------| +136 |[Single number](http://blog.csdn.net/daigualu/article/details/68921131) +1| [Two Sum](http://blog.csdn.net/daigualu/article/details/68957096) +447 |[Number of Boomerangs](http://blog.csdn.net/daigualu/article/details/68958818) +463 |[Island Perimeter](http://blog.csdn.net/daigualu/article/details/68959304) +409 |[Longest Palindrome](http://blog.csdn.net/daigualu/article/details/69053267) +438 |[Find All Anagrams in a String](http://blog.csdn.net/daigualu/article/details/71339879) +389 |[Find the Difference](http://blog.csdn.net/daigualu/article/details/71450823) +350 |[Intersection of Two Arrays II](http://blog.csdn.net/daigualu/article/details/69666351) +349 | [Intersection of Two Arrays](http://blog.csdn.net/daigualu/article/details/69666198) +500 |[Keyboard Row](http://blog.csdn.net/daigualu/article/details/71447614) +217| [Contains Duplicate](http://blog.csdn.net/daigualu/article/details/71123673) +204 | [Count Primes](http://blog.csdn.net/daigualu/article/details/71366483) +202 | [Happy Number](http://blog.csdn.net/daigualu/article/details/71433906) +219 |[Contains Duplicate II](http://blog.csdn.net/daigualu/article/details/71166985) +242 |[Valid Anagram](http://blog.csdn.net/daigualu/article/details/71358552) +290 |[Word Pattern](http://blog.csdn.net/daigualu/article/details/71358552) +205 |[Isomorphic Strings](http://blog.csdn.net/daigualu/article/details/71357419) + +## Linked List +|Number| Title(Blog URL)| +|------|-------| +141 | [Linked List Cycle](http://blog.csdn.net/daigualu/article/details/69055927) +237 | [Delete Node in a Linked List](http://blog.csdn.net/daigualu/article/details/69055991) +83 | [Remove Duplicates from Sorted List](http://blog.csdn.net/daigualu/article/details/69093677) +160 | [Intersection of Two Linked Lists](http://blog.csdn.net/daigualu/article/details/69526717) +203 |[Remove Linked List Elements](http://blog.csdn.net/daigualu/article/details/69389243) +206 | [Reverse Linked List](http://blog.csdn.net/daigualu/article/details/69372119) +234 | [Palindrome Linked List](http://blog.csdn.net/daigualu/article/details/69388513) +21 | [Merge Two Sorted Lists](http://blog.csdn.net/daigualu/article/details/69565969) + +--- + +## Math +|Number| Title(Blog URL)| +|------|-------| +231 | [Power of Two](http://blog.csdn.net/daigualu/article/details/69102931) +268| [Missing Number](http://blog.csdn.net/daigualu/article/details/69220202) +507 | [Perfect Number](http://blog.csdn.net/daigualu/article/details/69233798) +9| [Palindrome Number](http://blog.csdn.net/daigualu/article/details/72717009) +453 | [Minimum Moves to Equal Array Elements](http://blog.csdn.net/daigualu/article/details/72354061) +13 |Roman to Integer +441 |[Arranging Coins]() +415| [Add Strings](http://blog.csdn.net/daigualu/article/details/72356377) +400 |[Nth Digit](http://blog.csdn.net/daigualu/article/details/72572244) +367 |Valid Perfect Square +66| [Plus One](http://blog.csdn.net/daigualu/article/details/71056697) +7| [Reverse Integer](http://blog.csdn.net/daigualu/article/details/72464418) +204 |[Count Primes](http://blog.csdn.net/daigualu/article/details/71366483) +202 |[Happy Number](http://blog.csdn.net/daigualu/article/details/71433906) +172 |Factorial Trailing Zeroes +171 |[Excel Sheet Column Number](http://blog.csdn.net/daigualu/article/details/72717145) +168 |[Excel Sheet Column Title](http://blog.csdn.net/daigualu/article/details/72638706) +258 |Add Digits +263 |Ugly Number +69| [Sqrt(x)](http://blog.csdn.net/daigualu/article/details/72578272) +67 |[Add Binary](http://blog.csdn.net/daigualu/article/details/72638937) +246 |Strobogrammatic Number +326 |Power of Three + +--- + +## Two Pointers +|Number| Title(Blog URL)| +|------|-------| +345 |[Reverse Vowels of a String](http://blog.csdn.net/daigualu/article/details/69257693) +125 |[Valid Palindrome](http://blog.csdn.net/daigualu/article/details/69265381) +283| [Move Zeroes](http://blog.csdn.net/daigualu/article/details/69329038) +88 |[Merge Sorted Array](http://blog.csdn.net/daigualu/article/details/69367334) +234| [Palindrome Linked List](http://blog.csdn.net/daigualu/article/details/69388513) +349 |Intersection of Two Arrays +167 |[Two Sum II - Input array is sorted](http://blog.csdn.net/daigualu/article/details/69787679) +350| Intersection of Two Arrays II +344| Reverse String +28| Implement strStr() +27 |Remove Element +26| Remove Duplicates from Sorted Array +141| Linked List Cycle +532| K-diff Pairs in an Array + +--- + +## String +|Number| Title(Blog URL)| +|------|-------| +58| [Length of Last Word](http://blog.csdn.net/daigualu/article/details/69568460)| 31.5%| Easy +20 |[Valid Parentheses](http://blog.csdn.net/daigualu/article/details/69569622) |32.8% |Easy +520 |[Detect Capital](http://blog.csdn.net/daigualu/article/details/69663210)| 52.5%| Easy +459 |[Repeated Substring Pattern](http://blog.csdn.net/daigualu/article/details/69663545)| 38.4%| Easy +434 |[Number of Segments in a String](http://blog.csdn.net/daigualu/article/details/69664369) |37.0% |Easy +408 |Valid Word Abbreviation | 27.5% |Easy +13 |Roman to Integer |44.6%| Easy +14 |[Longest Common Prefix](http://blog.csdn.net/daigualu/article/details/69665015) |31.0% |Easy +383 |[Ransom Note](http://blog.csdn.net/daigualu/article/details/69665190) |46.5% |Easy +521 |Longest Uncommon Subsequence I |46.1% |Easy +345 |Reverse Vowels of a String| 37.9% |Easy +28 |Implement strStr() |27.5% |Easy +344 |Reverse String| 58.2%| Easy +293 |Flip Game |54.8% |Easy +38 |Count and Say |33.4% |Easy +157 |Read N Characters Given Read4 | 29.2%| Easy +541 |Reverse String II |44.1% |Easy +125 |Valid Palindrome |25.8% |Easy +67 |Add Binary |31.3% |Easy + +--- + +## Stack +|Number| Title(Blog URL)| Pass Rate| Degree | +|------|----------------|--------|----------| +225|[Implement Stack using Queues](http://blog.csdn.net/daigualu/article/details/70183272)| 32.0%| Easy +496| [Next Greater Element I](http://blog.csdn.net/daigualu/article/details/70185529) |57.5% |Easy +155| [Min Stack](http://blog.csdn.net/daigualu/article/details/70185814)| 27.4%| Easy +232| [Implement Queue using Stacks](http://blog.csdn.net/daigualu/article/details/70186010)| 35.8%| Easy +20| [Valid Parentheses](http://blog.csdn.net/daigualu/article/details/69569622)| 32.9%| Easy + +--- + +## Binary Search +|Number| Title(Blog URL)| Pass Rate| Degree | +|------|----------------|--------|----------| +367 |[Valid Perfect Square](http://blog.csdn.net/daigualu/article/details/69787644)| 37.8%| Easy +270| Closest Binary Search Tree Value| 38.8%| Easy +167 |[Two Sum II - Input array is sorted](http://blog.csdn.net/daigualu/article/details/69787679) |47.4%| Easy +441 |[Arranging Coins](http://blog.csdn.net/daigualu/article/details/69788500)| 36.0%| Easy +35| [Search Insert Position](http://blog.csdn.net/daigualu/article/details/66995617)| 39.3%| Easy +374 |Guess Number Higher or Lower |34.4%| Easy +69 |Sqrt(x) |27.4%| Easy| +278| [First Bad Version](http://blog.csdn.net/daigualu/article/details/69802371) |24.8% |Easy +475| Heaters |29.7%| Easy +350 |[Intersection of Two Arrays II](http://blog.csdn.net/daigualu/article/details/69666351) |44.1%| Easy +349| [Intersection of Two Arrays](http://blog.csdn.net/daigualu/article/details/69666198)| 46.5%| Easy + +--- + +## Dynamic Programming +|Number| Title(Blog URL)| Pass Rate| Degree | +|------|----------------|--------|----------| +53| [Maximum Subarray](http://blog.csdn.net/daigualu/article/details/69936974)| 39.2%| Easy| +169| [Majority Element](http://blog.csdn.net/daigualu/article/details/69937729)| 45.6%| Easy| +303| [Range Sum Query - Immutable](http://blog.csdn.net/daigualu/article/details/69938986)| 27.8%| Easy| +276 |Paint Fence | 34.1%| Easy| +523 |[Continuous Subarray Sum](http://blog.csdn.net/daigualu/article/details/69941770)| 21.6%| Easy| +256| Paint House | 45.9%| Easy| +198| [House Robber](http://blog.csdn.net/daigualu/article/details/69946684)| 38.1%| Easy| +121| Best Time to Buy and Sell Stock|40.1% |Easy| +70| Climbing Stairs |39.2%| Easy| + +--- + +## Tree +|Number| Title(Blog URL)| Pass Rate| Degree | +|------|----------------|--------|----------| +107| [Binary Tree Level Order Traversal II](http://blog.csdn.net/daigualu/article/details/70254459)| 39.0%| Easy +257 |[Binary Tree Paths](http://blog.csdn.net/daigualu/article/details/70340125)| 36.8%| Easy +501 |[Find Mode in Binary Search Tree](http://blog.csdn.net/daigualu/article/details/70341143)| 38.4%| Easy +437 |[Path Sum III](http://blog.csdn.net/daigualu/article/details/70342773)| 39.3% |Easy +404 |[Sum of Left Leaves](http://blog.csdn.net/daigualu/article/details/70482270)| 46.5%| Easy +112 |[Path Sum](http://blog.csdn.net/daigualu/article/details/70482285)| 33.5% |Easy +110 |[Balanced Binary Tree](http://blog.csdn.net/daigualu/article/details/70482667)| 36.8% |Easy +108 |[Convert Sorted Array to Binary Search Tree](http://blog.csdn.net/daigualu/article/details/70485834)| 41.3%| Easy +543 |[Diameter of Binary Tree](http://blog.csdn.net/daigualu/article/details/70491447)| 42.3%| Easy +226 |[Invert Binary Tree](http://blog.csdn.net/daigualu/article/details/70536685)| 50.8%| Easy +235 |[Lowest Common Ancestor of a Binary Search Tree](http://blog.csdn.net/daigualu/article/details/70539096)| 38.5%| Easy +104 |[Maximum Depth of Binary Tree](http://blog.csdn.net/daigualu/article/details/70541420)| 51.7%| Easy +111| [Minimum Depth of Binary Tree](http://blog.csdn.net/daigualu/article/details/70543969)| 32.7% |Easy +101 |[Symmetric Tree](http://blog.csdn.net/daigualu/article/details/70544774)| 37.9%| Easy +100| [Same Tree](http://blog.csdn.net/daigualu/article/details/70254478)| 45.8%| Easy \ No newline at end of file diff --git a/DetailsMd/Details.md b/DetailsMd/Details.md new file mode 100644 index 0000000..792cf35 --- /dev/null +++ b/DetailsMd/Details.md @@ -0,0 +1,201 @@ +## Details +## Array +|Number| Title(Blog URL)| +|------|-------| +35 |[Search Insert Position](http://blog.csdn.net/daigualu/article/details/66995617) +118| [Pascal's Triangle](http://blog.csdn.net/daigualu/article/details/67006388) +119 |[Pascal's Triangle II](http://blog.csdn.net/daigualu/article/details/67069088) +414| [Third Maximum Number](http://blog.csdn.net/daigualu/article/details/68063481) +121| [Best Time to Buy and Sell Stock](http://blog.csdn.net/daigualu/article/details/71038726) +66| [Plus One](http://blog.csdn.net/daigualu/article/details/71056697) +26 |[Remove Duplicates from Sorted Array](http://blog.csdn.net/daigualu/article/details/71064545) +27| [Remove Element](http://blog.csdn.net/daigualu/article/details/71104482) +122 |[Best Time to Buy and Sell Stock II](http://blog.csdn.net/daigualu/article/details/71104584) +268 |[Missing Number](http://blog.csdn.net/daigualu/article/details/69220202) +217| [Contains Duplicate](http://blog.csdn.net/daigualu/article/details/71123673) +532| [K-diff Pairs in an Array](http://blog.csdn.net/daigualu/article/details/71129806) +189| [Rotate Array](http://blog.csdn.net/daigualu/article/details/71159419) +169 |[Majority Element](http://blog.csdn.net/daigualu/article/details/69937729) +167 |[Two Sum II - Input array is sorted](http://blog.csdn.net/daigualu/article/details/69787679) +88 |[Merge Sorted Array](http://blog.csdn.net/daigualu/article/details/69367334) +53 |[Maximum Subarray](http://blog.csdn.net/daigualu/article/details/69936974) +485 |[Max Consecutive Ones](http://blog.csdn.net/daigualu/article/details/71216338) +283 |[Move Zeroes](http://blog.csdn.net/daigualu/article/details/69329038) +448 |[Find All Numbers Disappeared in an Array](http://blog.csdn.net/daigualu/article/details/71168875) +1| [Two Sum](http://blog.csdn.net/daigualu/article/details/68957096) +219 |[Contains Duplicate II](http://blog.csdn.net/daigualu/article/details/71166985) +566| [Reshape the Matrix](http://blog.csdn.net/daigualu/article/details/71275325) +561| [Array Partition I](http://blog.csdn.net/daigualu/article/details/71273279) + +--- + +## Hash Table +|Number| Title(Blog URL)| +|------|-------| +136 |[Single number](http://blog.csdn.net/daigualu/article/details/68921131) +1| [Two Sum](http://blog.csdn.net/daigualu/article/details/68957096) +447 |[Number of Boomerangs](http://blog.csdn.net/daigualu/article/details/68958818) +463 |[Island Perimeter](http://blog.csdn.net/daigualu/article/details/68959304) +409 |[Longest Palindrome](http://blog.csdn.net/daigualu/article/details/69053267) +438 |[Find All Anagrams in a String](http://blog.csdn.net/daigualu/article/details/71339879) +389 |[Find the Difference](http://blog.csdn.net/daigualu/article/details/71450823) +350 |[Intersection of Two Arrays II](http://blog.csdn.net/daigualu/article/details/69666351) +349 | [Intersection of Two Arrays](http://blog.csdn.net/daigualu/article/details/69666198) +500 |[Keyboard Row](http://blog.csdn.net/daigualu/article/details/71447614) +217| [Contains Duplicate](http://blog.csdn.net/daigualu/article/details/71123673) +204 | [Count Primes](http://blog.csdn.net/daigualu/article/details/71366483) +202 | [Happy Number](http://blog.csdn.net/daigualu/article/details/71433906) +219 |[Contains Duplicate II](http://blog.csdn.net/daigualu/article/details/71166985) +242 |[Valid Anagram](http://blog.csdn.net/daigualu/article/details/71358552) +290 |[Word Pattern](http://blog.csdn.net/daigualu/article/details/71358552) +205 |[Isomorphic Strings](http://blog.csdn.net/daigualu/article/details/71357419) + +## Linked List +|Number| Title(Blog URL)| +|------|-------| +141 | [Linked List Cycle](http://blog.csdn.net/daigualu/article/details/69055927) +237 | [Delete Node in a Linked List](http://blog.csdn.net/daigualu/article/details/69055991) +83 | [Remove Duplicates from Sorted List](http://blog.csdn.net/daigualu/article/details/69093677) +160 | [Intersection of Two Linked Lists](http://blog.csdn.net/daigualu/article/details/69526717) +203 |[Remove Linked List Elements](http://blog.csdn.net/daigualu/article/details/69389243) +206 | [Reverse Linked List](http://blog.csdn.net/daigualu/article/details/69372119) +234 | [Palindrome Linked List](http://blog.csdn.net/daigualu/article/details/69388513) +21 | [Merge Two Sorted Lists](http://blog.csdn.net/daigualu/article/details/69565969) + +--- + +## Math +|Number| Title(Blog URL)| +|------|-------| +231 | [Power of Two](http://blog.csdn.net/daigualu/article/details/69102931) +268| [Missing Number](http://blog.csdn.net/daigualu/article/details/69220202) +507 | [Perfect Number](http://blog.csdn.net/daigualu/article/details/69233798) +9| [Palindrome Number](http://blog.csdn.net/daigualu/article/details/72717009) +453 | [Minimum Moves to Equal Array Elements](http://blog.csdn.net/daigualu/article/details/72354061) +13 |Roman to Integer +441 |[Arranging Coins]() +415| [Add Strings](http://blog.csdn.net/daigualu/article/details/72356377) +400 |[Nth Digit](http://blog.csdn.net/daigualu/article/details/72572244) +367 |Valid Perfect Square +66| [Plus One](http://blog.csdn.net/daigualu/article/details/71056697) +7| [Reverse Integer](http://blog.csdn.net/daigualu/article/details/72464418) +204 |[Count Primes](http://blog.csdn.net/daigualu/article/details/71366483) +202 |[Happy Number](http://blog.csdn.net/daigualu/article/details/71433906) +172 |Factorial Trailing Zeroes +171 |[Excel Sheet Column Number](http://blog.csdn.net/daigualu/article/details/72717145) +168 |[Excel Sheet Column Title](http://blog.csdn.net/daigualu/article/details/72638706) +258 |Add Digits +263 |Ugly Number +69| [Sqrt(x)](http://blog.csdn.net/daigualu/article/details/72578272) +67 |[Add Binary](http://blog.csdn.net/daigualu/article/details/72638937) +246 |Strobogrammatic Number +326 |Power of Three + +--- + +## Two Pointers +|Number| Title(Blog URL)| +|------|-------| +345 |[Reverse Vowels of a String](http://blog.csdn.net/daigualu/article/details/69257693) +125 |[Valid Palindrome](http://blog.csdn.net/daigualu/article/details/69265381) +283| [Move Zeroes](http://blog.csdn.net/daigualu/article/details/69329038) +88 |[Merge Sorted Array](http://blog.csdn.net/daigualu/article/details/69367334) +234| [Palindrome Linked List](http://blog.csdn.net/daigualu/article/details/69388513) +349 |Intersection of Two Arrays +167 |[Two Sum II - Input array is sorted](http://blog.csdn.net/daigualu/article/details/69787679) +350| Intersection of Two Arrays II +344| Reverse String +28| Implement strStr() +27 |Remove Element +26| Remove Duplicates from Sorted Array +141| Linked List Cycle +532| K-diff Pairs in an Array + +--- + +## String +|Number| Title(Blog URL)| +|------|-------| +58| [Length of Last Word](http://blog.csdn.net/daigualu/article/details/69568460)| 31.5%| Easy +20 |[Valid Parentheses](http://blog.csdn.net/daigualu/article/details/69569622) |32.8% |Easy +520 |[Detect Capital](http://blog.csdn.net/daigualu/article/details/69663210)| 52.5%| Easy +459 |[Repeated Substring Pattern](http://blog.csdn.net/daigualu/article/details/69663545)| 38.4%| Easy +434 |[Number of Segments in a String](http://blog.csdn.net/daigualu/article/details/69664369) |37.0% |Easy +408 |Valid Word Abbreviation | 27.5% |Easy +13 |Roman to Integer |44.6%| Easy +14 |[Longest Common Prefix](http://blog.csdn.net/daigualu/article/details/69665015) |31.0% |Easy +383 |[Ransom Note](http://blog.csdn.net/daigualu/article/details/69665190) |46.5% |Easy +521 |Longest Uncommon Subsequence I |46.1% |Easy +345 |Reverse Vowels of a String| 37.9% |Easy +28 |Implement strStr() |27.5% |Easy +344 |Reverse String| 58.2%| Easy +293 |Flip Game |54.8% |Easy +38 |Count and Say |33.4% |Easy +157 |Read N Characters Given Read4 | 29.2%| Easy +541 |Reverse String II |44.1% |Easy +125 |Valid Palindrome |25.8% |Easy +67 |Add Binary |31.3% |Easy + +--- + +## Stack +|Number| Title(Blog URL)| Pass Rate| Degree | +|------|----------------|--------|----------| +225|[Implement Stack using Queues](http://blog.csdn.net/daigualu/article/details/70183272)| 32.0%| Easy +496| [Next Greater Element I](http://blog.csdn.net/daigualu/article/details/70185529) |57.5% |Easy +155| [Min Stack](http://blog.csdn.net/daigualu/article/details/70185814)| 27.4%| Easy +232| [Implement Queue using Stacks](http://blog.csdn.net/daigualu/article/details/70186010)| 35.8%| Easy +20| [Valid Parentheses](http://blog.csdn.net/daigualu/article/details/69569622)| 32.9%| Easy + +--- + +## Binary Search +|Number| Title(Blog URL)| Pass Rate| Degree | +|------|----------------|--------|----------| +367 |[Valid Perfect Square](http://blog.csdn.net/daigualu/article/details/69787644)| 37.8%| Easy +270| Closest Binary Search Tree Value| 38.8%| Easy +167 |[Two Sum II - Input array is sorted](http://blog.csdn.net/daigualu/article/details/69787679) |47.4%| Easy +441 |[Arranging Coins](http://blog.csdn.net/daigualu/article/details/69788500)| 36.0%| Easy +35| [Search Insert Position](http://blog.csdn.net/daigualu/article/details/66995617)| 39.3%| Easy +374 |Guess Number Higher or Lower |34.4%| Easy +69 |Sqrt(x) |27.4%| Easy| +278| [First Bad Version](http://blog.csdn.net/daigualu/article/details/69802371) |24.8% |Easy +475| Heaters |29.7%| Easy +350 |[Intersection of Two Arrays II](http://blog.csdn.net/daigualu/article/details/69666351) |44.1%| Easy +349| [Intersection of Two Arrays](http://blog.csdn.net/daigualu/article/details/69666198)| 46.5%| Easy + +--- + +## Dynamic Programming +|Number| Title(Blog URL)| Pass Rate| Degree | +|------|----------------|--------|----------| +53| [Maximum Subarray](http://blog.csdn.net/daigualu/article/details/69936974)| 39.2%| Easy| +169| [Majority Element](http://blog.csdn.net/daigualu/article/details/69937729)| 45.6%| Easy| +303| [Range Sum Query - Immutable](http://blog.csdn.net/daigualu/article/details/69938986)| 27.8%| Easy| +276 |Paint Fence | 34.1%| Easy| +523 |[Continuous Subarray Sum](http://blog.csdn.net/daigualu/article/details/69941770)| 21.6%| Easy| +256| Paint House | 45.9%| Easy| +198| [House Robber](http://blog.csdn.net/daigualu/article/details/69946684)| 38.1%| Easy| +121| Best Time to Buy and Sell Stock|40.1% |Easy| +70| Climbing Stairs |39.2%| Easy| + +--- + +## Tree +|Number| Title(Blog URL)| Pass Rate| Degree | +|------|----------------|--------|----------| +107| [Binary Tree Level Order Traversal II](http://blog.csdn.net/daigualu/article/details/70254459)| 39.0%| Easy +257 |[Binary Tree Paths](http://blog.csdn.net/daigualu/article/details/70340125)| 36.8%| Easy +501 |[Find Mode in Binary Search Tree](http://blog.csdn.net/daigualu/article/details/70341143)| 38.4%| Easy +437 |[Path Sum III](http://blog.csdn.net/daigualu/article/details/70342773)| 39.3% |Easy +404 |[Sum of Left Leaves](http://blog.csdn.net/daigualu/article/details/70482270)| 46.5%| Easy +112 |[Path Sum](http://blog.csdn.net/daigualu/article/details/70482285)| 33.5% |Easy +110 |[Balanced Binary Tree](http://blog.csdn.net/daigualu/article/details/70482667)| 36.8% |Easy +108 |[Convert Sorted Array to Binary Search Tree](http://blog.csdn.net/daigualu/article/details/70485834)| 41.3%| Easy +543 |[Diameter of Binary Tree](http://blog.csdn.net/daigualu/article/details/70491447)| 42.3%| Easy +226 |[Invert Binary Tree](http://blog.csdn.net/daigualu/article/details/70536685)| 50.8%| Easy +235 |[Lowest Common Ancestor of a Binary Search Tree](http://blog.csdn.net/daigualu/article/details/70539096)| 38.5%| Easy +104 |[Maximum Depth of Binary Tree](http://blog.csdn.net/daigualu/article/details/70541420)| 51.7%| Easy +111| [Minimum Depth of Binary Tree](http://blog.csdn.net/daigualu/article/details/70543969)| 32.7% |Easy +101 |[Symmetric Tree](http://blog.csdn.net/daigualu/article/details/70544774)| 37.9%| Easy +100| [Same Tree](http://blog.csdn.net/daigualu/article/details/70254478)| 45.8%| Easy \ No newline at end of file diff --git a/DetailsMd/DetailsArray.md b/DetailsMd/DetailsArray.md new file mode 100644 index 0000000..452cbf9 --- /dev/null +++ b/DetailsMd/DetailsArray.md @@ -0,0 +1,27 @@ +## Array +|Number| Title(Blog URL)| +|------|-------| +35 |[Search Insert Position](http://blog.csdn.net/daigualu/article/details/66995617) +118| [Pascal's Triangle](http://blog.csdn.net/daigualu/article/details/67006388) +119 |[Pascal's Triangle II](http://blog.csdn.net/daigualu/article/details/67069088) +414| [Third Maximum Number](http://blog.csdn.net/daigualu/article/details/68063481) +121| [Best Time to Buy and Sell Stock](http://blog.csdn.net/daigualu/article/details/71038726) +66| [Plus One](http://blog.csdn.net/daigualu/article/details/71056697) +26 |[Remove Duplicates from Sorted Array](http://blog.csdn.net/daigualu/article/details/71064545) +27| [Remove Element](http://blog.csdn.net/daigualu/article/details/71104482) +122 |[Best Time to Buy and Sell Stock II](http://blog.csdn.net/daigualu/article/details/71104584) +268 |[Missing Number](http://blog.csdn.net/daigualu/article/details/69220202) +217| [Contains Duplicate](http://blog.csdn.net/daigualu/article/details/71123673) +532| [K-diff Pairs in an Array](http://blog.csdn.net/daigualu/article/details/71129806) +189| [Rotate Array](http://blog.csdn.net/daigualu/article/details/71159419) +169 |[Majority Element](http://blog.csdn.net/daigualu/article/details/69937729) +167 |[Two Sum II - Input array is sorted](http://blog.csdn.net/daigualu/article/details/69787679) +88 |[Merge Sorted Array](http://blog.csdn.net/daigualu/article/details/69367334) +53 |[Maximum Subarray](http://blog.csdn.net/daigualu/article/details/69936974) +485 |[Max Consecutive Ones](http://blog.csdn.net/daigualu/article/details/71216338) +283 |[Move Zeroes](http://blog.csdn.net/daigualu/article/details/69329038) +448 |[Find All Numbers Disappeared in an Array](http://blog.csdn.net/daigualu/article/details/71168875) +1| [Two Sum](http://blog.csdn.net/daigualu/article/details/68957096) +219 |[Contains Duplicate II](http://blog.csdn.net/daigualu/article/details/71166985) +566| [Reshape the Matrix](http://blog.csdn.net/daigualu/article/details/71275325) +561| [Array Partition I](http://blog.csdn.net/daigualu/article/details/71273279) diff --git a/DetailsMd/DetailsBinarySearch.md b/DetailsMd/DetailsBinarySearch.md new file mode 100644 index 0000000..1ddd919 --- /dev/null +++ b/DetailsMd/DetailsBinarySearch.md @@ -0,0 +1,14 @@ +## Binary Search +|Number| Title(Blog URL)| Pass Rate| Degree | +|------|----------------|--------|----------| +367 |[Valid Perfect Square](http://blog.csdn.net/daigualu/article/details/69787644)| 37.8%| Easy +270| Closest Binary Search Tree Value| 38.8%| Easy +167 |[Two Sum II - Input array is sorted](http://blog.csdn.net/daigualu/article/details/69787679) |47.4%| Easy +441 |[Arranging Coins](http://blog.csdn.net/daigualu/article/details/69788500)| 36.0%| Easy +35| [Search Insert Position](http://blog.csdn.net/daigualu/article/details/66995617)| 39.3%| Easy +374 |Guess Number Higher or Lower |34.4%| Easy +69 |Sqrt(x) |27.4%| Easy| +278| [First Bad Version](http://blog.csdn.net/daigualu/article/details/69802371) |24.8% |Easy +475| Heaters |29.7%| Easy +350 |[Intersection of Two Arrays II](http://blog.csdn.net/daigualu/article/details/69666351) |44.1%| Easy +349| [Intersection of Two Arrays](http://blog.csdn.net/daigualu/article/details/69666198)| 46.5%| Easy \ No newline at end of file diff --git a/DetailsMd/DetailsBitManipulation.md b/DetailsMd/DetailsBitManipulation.md new file mode 100644 index 0000000..629fd76 --- /dev/null +++ b/DetailsMd/DetailsBitManipulation.md @@ -0,0 +1,7 @@ +## Bit Manipulation +|Number| Title(Blog URL)| +|------|-------| +342 |[Power of Four](http://blog.csdn.net/daigualu/article/details/72821233) +461 |[Hamming Distance](http://blog.csdn.net/daigualu/article/details/72830624) +476 |[Number Complement](http://blog.csdn.net/daigualu/article/details/72843822) +397 |[Integer Replacement](http://blog.csdn.net/daigualu/article/details/72861851) diff --git a/DetailsMd/DetailsDynamicProgramming.md b/DetailsMd/DetailsDynamicProgramming.md new file mode 100644 index 0000000..bd5cd05 --- /dev/null +++ b/DetailsMd/DetailsDynamicProgramming.md @@ -0,0 +1,12 @@ +## Dynamic Programming +|Number| Title(Blog URL)| Pass Rate| Degree | +|------|----------------|--------|----------| +53| [Maximum Subarray](http://blog.csdn.net/daigualu/article/details/69936974)| 39.2%| Easy| +169| [Majority Element](http://blog.csdn.net/daigualu/article/details/69937729)| 45.6%| Easy| +303| [Range Sum Query - Immutable](http://blog.csdn.net/daigualu/article/details/69938986)| 27.8%| Easy| +276 |Paint Fence | 34.1%| Easy| +523 |[Continuous Subarray Sum](http://blog.csdn.net/daigualu/article/details/69941770)| 21.6%| Easy| +256| Paint House | 45.9%| Easy| +198| [House Robber](http://blog.csdn.net/daigualu/article/details/69946684)| 38.1%| Easy| +121| Best Time to Buy and Sell Stock|40.1% |Easy| +70| Climbing Stairs |39.2%| Easy| \ No newline at end of file diff --git a/DetailsMd/DetailsHashTable.md b/DetailsMd/DetailsHashTable.md new file mode 100644 index 0000000..f168873 --- /dev/null +++ b/DetailsMd/DetailsHashTable.md @@ -0,0 +1,20 @@ +## Hash Table +|Number| Title(Blog URL)| +|------|-------| +136 |[Single number](http://blog.csdn.net/daigualu/article/details/68921131) +1| [Two Sum](http://blog.csdn.net/daigualu/article/details/68957096) +447 |[Number of Boomerangs](http://blog.csdn.net/daigualu/article/details/68958818) +463 |[Island Perimeter](http://blog.csdn.net/daigualu/article/details/68959304) +409 |[Longest Palindrome](http://blog.csdn.net/daigualu/article/details/69053267) +438 |[Find All Anagrams in a String](http://blog.csdn.net/daigualu/article/details/71339879) +389 |[Find the Difference](http://blog.csdn.net/daigualu/article/details/71450823) +350 |[Intersection of Two Arrays II](http://blog.csdn.net/daigualu/article/details/69666351) +349 | [Intersection of Two Arrays](http://blog.csdn.net/daigualu/article/details/69666198) +500 |[Keyboard Row](http://blog.csdn.net/daigualu/article/details/71447614) +217| [Contains Duplicate](http://blog.csdn.net/daigualu/article/details/71123673) +204 | [Count Primes](http://blog.csdn.net/daigualu/article/details/71366483) +202 | [Happy Number](http://blog.csdn.net/daigualu/article/details/71433906) +219 |[Contains Duplicate II](http://blog.csdn.net/daigualu/article/details/71166985) +242 |[Valid Anagram](http://blog.csdn.net/daigualu/article/details/71358552) +290 |[Word Pattern](http://blog.csdn.net/daigualu/article/details/71358552) +205 |[Isomorphic Strings](http://blog.csdn.net/daigualu/article/details/71357419) diff --git a/DetailsMd/DetailsLinkedList.md b/DetailsMd/DetailsLinkedList.md new file mode 100644 index 0000000..8e9e598 --- /dev/null +++ b/DetailsMd/DetailsLinkedList.md @@ -0,0 +1,12 @@ +## Linked List +|Number| Title(Blog URL)| +|------|-------| +141 | [Linked List Cycle](http://blog.csdn.net/daigualu/article/details/69055927) +237 | [Delete Node in a Linked List](http://blog.csdn.net/daigualu/article/details/69055991) +83 | [Remove Duplicates from Sorted List](http://blog.csdn.net/daigualu/article/details/69093677) +160 | [Intersection of Two Linked Lists](http://blog.csdn.net/daigualu/article/details/69526717) +203 |[Remove Linked List Elements](http://blog.csdn.net/daigualu/article/details/69389243) +206 | [Reverse Linked List](http://blog.csdn.net/daigualu/article/details/69372119) +234 | [Palindrome Linked List](http://blog.csdn.net/daigualu/article/details/69388513) +21 | [Merge Two Sorted Lists](http://blog.csdn.net/daigualu/article/details/69565969) + diff --git a/DetailsMd/DetailsMath.md b/DetailsMd/DetailsMath.md new file mode 100644 index 0000000..7e2f755 --- /dev/null +++ b/DetailsMd/DetailsMath.md @@ -0,0 +1,27 @@ +## Math +|Number| Title(Blog URL)| +|------|-------| +231 | [Power of Two](http://blog.csdn.net/daigualu/article/details/69102931) +268| [Missing Number](http://blog.csdn.net/daigualu/article/details/69220202) +507 | [Perfect Number](http://blog.csdn.net/daigualu/article/details/69233798) +9| [Palindrome Number](http://blog.csdn.net/daigualu/article/details/72717009) +453 | [Minimum Moves to Equal Array Elements](http://blog.csdn.net/daigualu/article/details/72354061) +13 |Roman to Integer +441 |[Arranging Coins]() +415| [Add Strings](http://blog.csdn.net/daigualu/article/details/72356377) +400 |[Nth Digit](http://blog.csdn.net/daigualu/article/details/72572244) +367 |Valid Perfect Square +66| [Plus One](http://blog.csdn.net/daigualu/article/details/71056697) +7| [Reverse Integer](http://blog.csdn.net/daigualu/article/details/72464418) +204 |[Count Primes](http://blog.csdn.net/daigualu/article/details/71366483) +202 |[Happy Number](http://blog.csdn.net/daigualu/article/details/71433906) +172 |Factorial Trailing Zeroes +171 |[Excel Sheet Column Number](http://blog.csdn.net/daigualu/article/details/72717145) +168 |[Excel Sheet Column Title](http://blog.csdn.net/daigualu/article/details/72638706) +258 |Add Digits +263 |Ugly Number +69| [Sqrt(x)](http://blog.csdn.net/daigualu/article/details/72578272) +67 |[Add Binary](http://blog.csdn.net/daigualu/article/details/72638937) +246 |Strobogrammatic Number +326 |Power of Three +13 |[RomanToInteger](http://blog.csdn.net/daigualu/article/details/72867026) \ No newline at end of file diff --git a/DetailsMd/DetailsSort.md b/DetailsMd/DetailsSort.md new file mode 100644 index 0000000..7e806ca --- /dev/null +++ b/DetailsMd/DetailsSort.md @@ -0,0 +1,4 @@ +## Two Pointers +|Number| Title(Blog URL)| +|------|-------| +324|[Wiggle Sort II](http://blog.csdn.net/daigualu/article/details/72820281) \ No newline at end of file diff --git a/DetailsMd/DetailsStack.md b/DetailsMd/DetailsStack.md new file mode 100644 index 0000000..22fdb6d --- /dev/null +++ b/DetailsMd/DetailsStack.md @@ -0,0 +1,8 @@ +## Stack +|Number| Title(Blog URL)| Pass Rate| Degree | +|------|----------------|--------|----------| +225|[Implement Stack using Queues](http://blog.csdn.net/daigualu/article/details/70183272)| 32.0%| Easy +496| [Next Greater Element I](http://blog.csdn.net/daigualu/article/details/70185529) |57.5% |Easy +155| [Min Stack](http://blog.csdn.net/daigualu/article/details/70185814)| 27.4%| Easy +232| [Implement Queue using Stacks](http://blog.csdn.net/daigualu/article/details/70186010)| 35.8%| Easy +20| [Valid Parentheses](http://blog.csdn.net/daigualu/article/details/69569622)| 32.9%| Easy \ No newline at end of file diff --git a/DetailsMd/DetailsString.md b/DetailsMd/DetailsString.md new file mode 100644 index 0000000..8fe56fc --- /dev/null +++ b/DetailsMd/DetailsString.md @@ -0,0 +1,22 @@ +## String +|Number| Title(Blog URL)| +|------|-------| +58| [Length of Last Word](http://blog.csdn.net/daigualu/article/details/69568460)| 31.5%| Easy +20 |[Valid Parentheses](http://blog.csdn.net/daigualu/article/details/69569622) |32.8% |Easy +520 |[Detect Capital](http://blog.csdn.net/daigualu/article/details/69663210)| 52.5%| Easy +459 |[Repeated Substring Pattern](http://blog.csdn.net/daigualu/article/details/69663545)| 38.4%| Easy +434 |[Number of Segments in a String](http://blog.csdn.net/daigualu/article/details/69664369) |37.0% |Easy +408 |Valid Word Abbreviation | 27.5% |Easy +13 |Roman to Integer |44.6%| Easy +14 |[Longest Common Prefix](http://blog.csdn.net/daigualu/article/details/69665015) |31.0% |Easy +383 |[Ransom Note](http://blog.csdn.net/daigualu/article/details/69665190) |46.5% |Easy +521 |Longest Uncommon Subsequence I |46.1% |Easy +345 |Reverse Vowels of a String| 37.9% |Easy +28 |Implement strStr() |27.5% |Easy +344 |Reverse String| 58.2%| Easy +293 |Flip Game |54.8% |Easy +38 |Count and Say |33.4% |Easy +157 |Read N Characters Given Read4 | 29.2%| Easy +541 |Reverse String II |44.1% |Easy +125 |Valid Palindrome |25.8% |Easy +67 |Add Binary |31.3% |Easy \ No newline at end of file diff --git a/DetailsMd/DetailsTree.md b/DetailsMd/DetailsTree.md new file mode 100644 index 0000000..d7f9685 --- /dev/null +++ b/DetailsMd/DetailsTree.md @@ -0,0 +1,18 @@ +## Tree +|Number| Title(Blog URL)| Pass Rate| Degree | +|------|----------------|--------|----------| +107| [Binary Tree Level Order Traversal II](http://blog.csdn.net/daigualu/article/details/70254459)| 39.0%| Easy +257 |[Binary Tree Paths](http://blog.csdn.net/daigualu/article/details/70340125)| 36.8%| Easy +501 |[Find Mode in Binary Search Tree](http://blog.csdn.net/daigualu/article/details/70341143)| 38.4%| Easy +437 |[Path Sum III](http://blog.csdn.net/daigualu/article/details/70342773)| 39.3% |Easy +404 |[Sum of Left Leaves](http://blog.csdn.net/daigualu/article/details/70482270)| 46.5%| Easy +112 |[Path Sum](http://blog.csdn.net/daigualu/article/details/70482285)| 33.5% |Easy +110 |[Balanced Binary Tree](http://blog.csdn.net/daigualu/article/details/70482667)| 36.8% |Easy +108 |[Convert Sorted Array to Binary Search Tree](http://blog.csdn.net/daigualu/article/details/70485834)| 41.3%| Easy +543 |[Diameter of Binary Tree](http://blog.csdn.net/daigualu/article/details/70491447)| 42.3%| Easy +226 |[Invert Binary Tree](http://blog.csdn.net/daigualu/article/details/70536685)| 50.8%| Easy +235 |[Lowest Common Ancestor of a Binary Search Tree](http://blog.csdn.net/daigualu/article/details/70539096)| 38.5%| Easy +104 |[Maximum Depth of Binary Tree](http://blog.csdn.net/daigualu/article/details/70541420)| 51.7%| Easy +111| [Minimum Depth of Binary Tree](http://blog.csdn.net/daigualu/article/details/70543969)| 32.7% |Easy +101 |[Symmetric Tree](http://blog.csdn.net/daigualu/article/details/70544774)| 37.9%| Easy +100| [Same Tree](http://blog.csdn.net/daigualu/article/details/70254478)| 45.8%| Easy \ No newline at end of file diff --git a/DetailsMd/DetailsTwoPointers.md b/DetailsMd/DetailsTwoPointers.md new file mode 100644 index 0000000..46c4d9f --- /dev/null +++ b/DetailsMd/DetailsTwoPointers.md @@ -0,0 +1,17 @@ +## Two Pointers +|Number| Title(Blog URL)| +|------|-------| +345 |[Reverse Vowels of a String](http://blog.csdn.net/daigualu/article/details/69257693) +125 |[Valid Palindrome](http://blog.csdn.net/daigualu/article/details/69265381) +283| [Move Zeroes](http://blog.csdn.net/daigualu/article/details/69329038) +88 |[Merge Sorted Array](http://blog.csdn.net/daigualu/article/details/69367334) +234| [Palindrome Linked List](http://blog.csdn.net/daigualu/article/details/69388513) +349 |Intersection of Two Arrays +167 |[Two Sum II - Input array is sorted](http://blog.csdn.net/daigualu/article/details/69787679) +350| Intersection of Two Arrays II +344| Reverse String +28| Implement strStr() +27 |Remove Element +26| Remove Duplicates from Sorted Array +141| Linked List Cycle +532| K-diff Pairs in an Array \ No newline at end of file diff --git a/HashTable/HashTable.Lib/DistributeCandiessln.cs b/HashTable/HashTable.Lib/DistributeCandiessln.cs new file mode 100644 index 0000000..823ea0e --- /dev/null +++ b/HashTable/HashTable.Lib/DistributeCandiessln.cs @@ -0,0 +1,48 @@ +/* ============================================================================== + * 功能描述:DistributeCandies + * 创 建 者:gz + * 创建日期:2017/5/11 13:38:38 + * ==============================================================================*/ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +//Given an integer array with even length, where different numbers in this array represent different kinds of candies. +//Each number means one candy of the corresponding kind. You need to distribute these candies equally +//in number to brother and sister. Return the maximum number of kinds of candies the sister could gain. + +//Example 1: +//Input: candies = [1,1,2,2,3,3] +//Output: 3 +//Explanation: +//There are three different kinds of candies (1, 2 and 3), and two candies for each kind. +//Optimal distribution: The sister has candies [1,2,3] and the brother has candies [1,2,3], too. +//The sister has three different kinds of candies. +//Example 2: +//Input: candies = [1,1,2,3] +//Output: 2 +//Explanation: For example, the sister has candies [2,3] and the brother has candies [1,1]. +//The sister has two different kinds of candies, the brother has only one kind of candies. +namespace RandomizedCollection +{ + /// + /// DistributeCandies [1,1,1,1] + /// + public class DistributeCandiessln + { + public int DistributeCandies(int[] candies) + { + int n = candies.Length; + HashSet kinds = new HashSet(); + foreach (var item in candies) + { + if (!kinds.Contains(item)) + kinds.Add(item); + } + if (kinds.Count > n/2) + return n/2; //糖果要均分,所以种类再多,也只能分到n/2种 + return kinds.Count; //种类较少,妹妹最多分到kinds.Count种,如[1,1,1,1], 返回1 + } + + } +} diff --git a/HashTable/HashTable.Lib/FindDifferenceSln.cs b/HashTable/HashTable.Lib/FindDifferenceSln.cs new file mode 100644 index 0000000..79c55c3 --- /dev/null +++ b/HashTable/HashTable.Lib/FindDifferenceSln.cs @@ -0,0 +1,34 @@ +/* ============================================================================== + * 功能描述:FindDifferenceSln + * 创 建 者:gz + * 创建日期:2017/5/9 13:23:46 + * ==============================================================================*/ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace HashTable.Lib +{ + /// + /// FindDifferenceSln + /// + public class FindDifferenceSln + { + public char FindTheDifference(string s, string t) + { + int[] hash = new int[123]; //97~122 + foreach (var ch in s) + hash[Convert.ToInt32(ch)]++; + foreach (var ch in t) + { + int tmp = Convert.ToInt32(ch); + hash[tmp]--; + if (hash[tmp] < 0) + return ch; + } + return ' '; + } + + } +} diff --git a/HashTable/HashTable.Lib/FrequSortSln.cs b/HashTable/HashTable.Lib/FrequSortSln.cs new file mode 100644 index 0000000..66072f4 --- /dev/null +++ b/HashTable/HashTable.Lib/FrequSortSln.cs @@ -0,0 +1,83 @@ +/* ============================================================================== + * 功能描述:FrequSort + * 创 建 者:gz + * 创建日期:2017/5/10 18:05:01 + * ==============================================================================*/ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +//Given a string, sort it in decreasing order based on the frequency of characters. + +//Example 1: + +//Input: +//"tree" + +//Output: +//"eert" + +//Explanation: +//'e' appears twice while 'r' and 't' both appear once. +//So 'e' must appear before both 'r' and 't'. Therefore "eetr" is also a valid answer. +//Example 2: + +//Input: +//"cccaaa" + +//Output: +//"cccaaa" + +//Explanation: +//Both 'c' and 'a' appear three times, so "aaaccc" is also a valid answer. +//Note that "cacaca" is incorrect, as the same characters must be together. +//Example 3: + +//Input: +//"Aabb" + +//Output: +//"bbAa" + +//Explanation: +//"bbaA" is also a valid answer, but "Aabb" is incorrect. +//Note that 'A' and 'a' are treated as two different characters. +namespace FrequencySortSln +{ + /// + /// FrequSort + /// + public class FrequSortSln + { + public string FrequencySort(string s) + { + Dictionary freq = new Dictionary(); + string[] buckets = new string[s.Length+1]; //索引用作字符个数,最大的个数索引也为最大 + //count char frequency + foreach (var c in s) + { + if (!freq.ContainsKey(c)) + freq.Add(c, 1); + else freq[c]++; + } + //put char to buckets + foreach (var item in freq) + { + int n = item.Value; + char c = item.Key; + StringBuilder builder = new StringBuilder(); + buckets[n] += builder.Append(c, n).ToString(); + } + StringBuilder builder2 = new StringBuilder(); + //form string + for (int i = s.Length; i > 0; i--) + { + if (buckets[i] != null) + builder2.Append(buckets[i]); + } + return builder2.ToString(); + } + + } +} diff --git a/HashTable/HashTable.Lib/HashTable.Lib.csproj b/HashTable/HashTable.Lib/HashTable.Lib.csproj index af5bcb7..89eb148 100644 --- a/HashTable/HashTable.Lib/HashTable.Lib.csproj +++ b/HashTable/HashTable.Lib/HashTable.Lib.csproj @@ -41,6 +41,8 @@ + + diff --git a/HashTable/HashTable.Lib/KeyBoard.jpg b/HashTable/HashTable.Lib/KeyBoard.jpg new file mode 100644 index 0000000..1e5266e Binary files /dev/null and b/HashTable/HashTable.Lib/KeyBoard.jpg differ diff --git a/HashTable/HashTable.Lib/KeyBoradRowSln.cs b/HashTable/HashTable.Lib/KeyBoradRowSln.cs new file mode 100644 index 0000000..6e996aa --- /dev/null +++ b/HashTable/HashTable.Lib/KeyBoradRowSln.cs @@ -0,0 +1,67 @@ +/* ============================================================================== + * 功能描述:KeyBoradRowSln + * 创 建 者:gz + * 创建日期:2017/5/9 12:44:32 + * ==============================================================================*/ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +//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. + + +//American keyboard + + +//Example 1: +//Input: ["Hello", "Alaska", "Dad", "Peace"] +//Output: ["Alaska", "Dad"] +namespace HashTable.Lib +{ + /// + /// KeyBoradRowSln + /// + public class KeyBoradRowSln + { + public string[] FindWords(string[] words) + { + int[] hash = new int[123]; + char[] chs1 = {'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p'}; + foreach (var ch in chs1) + { + hash[Convert.ToInt32(ch)] = 1; //q + hash[Convert.ToInt32(ch)-32] = 1; //Q + } + chs1 = new[] {'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l'}; + foreach (var ch in chs1) + { + hash[Convert.ToInt32(ch)] = 2; + hash[Convert.ToInt32(ch) - 32] = 2; + } + chs1 = new[] {'z', 'x', 'c', 'v', 'b', 'n', 'm'}; + foreach (var ch in chs1) + { + hash[Convert.ToInt32(ch)] = 3; + hash[Convert.ToInt32(ch) - 32] = 3; + } + List rtn = new List(); + foreach (var word in words) + { + if(string.IsNullOrEmpty(word)) continue; + int row = hash[word[0]]; + bool allflag = true; + foreach (var ch in word) + { + if (hash[ch] != row) + { + allflag = false; + break; + } + } + if(allflag==true) rtn.Add(word); + } + return rtn.ToArray(); + } + + } +} diff --git a/HashTable/HashTable.Lib/Randomized.jpg b/HashTable/HashTable.Lib/Randomized.jpg new file mode 100644 index 0000000..bbaf8d3 Binary files /dev/null and b/HashTable/HashTable.Lib/Randomized.jpg differ diff --git a/HashTable/HashTable.Lib/RandomizedCollection.cs b/HashTable/HashTable.Lib/RandomizedCollection.cs new file mode 100644 index 0000000..b5bff07 --- /dev/null +++ b/HashTable/HashTable.Lib/RandomizedCollection.cs @@ -0,0 +1,114 @@ +/* ============================================================================== + * 功能描述:IDG + * 创 建 者:gz + * 创建日期:2017/5/11 + * ==============================================================================*/ +using System; +using System.Collections.Generic; +using System.Data.SqlTypes; +using System.Linq; +using System.Text; +using System.Threading; + +//Design a data structure that supports all following operations in average O(1) time. + +//Note: Duplicate elements are allowed. insert(val): Inserts an item val +//to the collection. remove(val): Removes an item val from the +//collection if present. getRandom: Returns a random element from +//current collection of elements. The probability of each element being +//returned is linearly related to the number of same value the +//collection contains. +//Example: + +//// Init an empty collection. +//RandomizedCollection collection = new RandomizedCollection(); + +//// Inserts 1 to the collection. Returns true as the collection did not contain 1. +//collection.insert(1); + +//// Inserts another 1 to the collection. Returns false as the collection contained 1. Collection now contains [1,1]. +//collection.insert(1); + +//// Inserts 2 to the collection, returns true. Collection now contains [1,1,2]. +//collection.insert(2); + +//// getRandom should return 1 with the probability 2/3, and returns 2 with the probability 1/3. +//collection.getRandom(); + +//// Removes 1 from the collection, returns true. Collection now contains [1,2]. +//collection.remove(1); + +//// getRandom should return 1 and 2 both equally likely. +//collection.getRandom(); +namespace IDGSln +{ + + /// + /// IDG + /// + public class RandomizedCollection + { + //insert remove getRandom + private Dictionary> _dict; //key: value, Value: index collection + private List _valList; //element of value list, for it can get the O(1) visit + public RandomizedCollection() + { + _dict = new Dictionary>(); + _valList = new List(); + } + + public bool Insert(int val) + { + if (!_dict.ContainsKey(val)) + { + _dict.Add(val, new List { _valList.Count }); + _valList.Add(val); + return true; + } + _dict[val].Add(_valList.Count); + _valList.Add(val); + return false; + } + + public bool Remove(int val) + { + if (!_dict.ContainsKey(val)) return false; + List removeIndexCollection = _dict[val]; //_dict.Values: element index collection + + swapToLast(removeIndexCollection[removeIndexCollection.Count-1]); + _valList.Remove(val); + if (removeIndexCollection.Count == 1) + _dict.Remove(val); + else _dict[val].Remove(val); + return true; + } + + //i-待移除元素的索引 + //将待移除元素移到_valList的末尾,修改原来末尾元素在字典中的键值 + private void swapToLast(int i) + { + int lastIndex = _valList.Count - 1; + if (i > lastIndex) return; + int lastVal = _valList[lastIndex]; + int tmpVal = _valList[i]; + _valList[i] = lastVal; // the key is to prove " i < lastIndex" !!! + _valList[lastIndex] = tmpVal; + //this is important, to update the last index value in dictionary + if(i!=lastIndex) //i 不是末尾元素 + _dict[lastVal].Add(i); + } + + public int GetRandom() + { + long tick = DateTime.Now.Ticks; + Random ran = new Random((int)(tick & 0xffffffffL) | (int)(tick >> 32)); + int randnum = ran.Next(_valList.Count); + if (_valList.Count == 0) return -1; + Thread.Sleep(20); + + return _valList[randnum]; + } + + } + +} diff --git a/HashTable/HashTable.Lib/RandomizedSet.cs b/HashTable/HashTable.Lib/RandomizedSet.cs new file mode 100644 index 0000000..64982f8 --- /dev/null +++ b/HashTable/HashTable.Lib/RandomizedSet.cs @@ -0,0 +1,80 @@ +/* ============================================================================== + * 功能描述:IDG + * 创 建 者:gz + * 创建日期:2017/5/10 12:41:14 + * ==============================================================================*/ +using System; +using System.Collections.Generic; +using System.Data.SqlTypes; +using System.Linq; +using System.Text; +using System.Threading; + +namespace IDGSln +{ + + /// + /// IDG + /// + public class RandomizedSet + { + //insert remove getRandom + private Dictionary _dict; //key: value, Value: index + private List _valList; //element of value list, for it can get the O(1) visit + public RandomizedSet() + { + _dict = new Dictionary(); + _valList = new List(); + } + + public bool Insert(int val) + { + if (!_dict.ContainsKey(val)) + { + _dict.Add(val, _valList.Count); + _valList.Add(val); + return true; + } + return false; + } + + public bool Remove(int val) + { + if (!_dict.ContainsKey(val)) return false; + int removeIndex = _dict[val]; //_dict.Values: element index collection + + swapToLast(removeIndex); + + _valList.Remove(val); + _dict.Remove(val); + return true; + } + + //i-待移除元素的索引 + //将待移除元素移到_valList的末尾,修改原来末尾元素在字典中的键值 + private void swapToLast(int i) + { + int lastIndex = _valList.Count - 1; + if (i > lastIndex) return; + int lastVal = _valList[lastIndex]; + int tmpVal = _valList[i]; + _valList[i] = lastVal; // the key is to prove " i < lastIndex" !!! + _valList[lastIndex] = tmpVal; + //this is important, to update the last index value in dictionary + _dict[lastVal] = i; + } + + public int GetRandom() + { + long tick = DateTime.Now.Ticks; + Random ran = new Random((int)(tick & 0xffffffffL) | (int)(tick >> 32)); + int randnum = ran.Next(_valList.Count); + if (_valList.Count == 0) return -1; + Thread.Sleep(20); + + return _valList[randnum]; + } + + } + +} diff --git a/Images/floyd circle.jpg b/Images/floyd circle.jpg new file mode 100644 index 0000000..45e4f68 Binary files /dev/null and b/Images/floyd circle.jpg differ diff --git a/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/1.ico.deploy b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/1.ico.deploy new file mode 100644 index 0000000..57e76d1 Binary files /dev/null and b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/1.ico.deploy differ diff --git a/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/Assembly/Infragistics2.Shared.v12.1.dll.deploy b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/Assembly/Infragistics2.Shared.v12.1.dll.deploy new file mode 100644 index 0000000..b2206bc Binary files /dev/null and b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/Assembly/Infragistics2.Shared.v12.1.dll.deploy differ diff --git a/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/Assembly/Infragistics2.Win.UltraWinEditors.v12.1.dll.deploy b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/Assembly/Infragistics2.Win.UltraWinEditors.v12.1.dll.deploy new file mode 100644 index 0000000..7ad6c01 Binary files /dev/null and b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/Assembly/Infragistics2.Win.UltraWinEditors.v12.1.dll.deploy differ diff --git a/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/Assembly/Infragistics2.Win.UltraWinGrid.v12.1.dll.deploy b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/Assembly/Infragistics2.Win.UltraWinGrid.v12.1.dll.deploy new file mode 100644 index 0000000..d167405 Binary files /dev/null and b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/Assembly/Infragistics2.Win.UltraWinGrid.v12.1.dll.deploy differ diff --git a/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/Assembly/Infragistics2.Win.v12.1.dll.deploy b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/Assembly/Infragistics2.Win.v12.1.dll.deploy new file mode 100644 index 0000000..62947ff Binary files /dev/null and b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/Assembly/Infragistics2.Win.v12.1.dll.deploy differ diff --git a/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/DataMd/BinarySearch.txt.deploy b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/DataMd/BinarySearch.txt.deploy new file mode 100644 index 0000000..7c1f348 --- /dev/null +++ b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/DataMd/BinarySearch.txt.deploy @@ -0,0 +1,11 @@ +367 |[Valid Perfect Square](http://blog.csdn.net/daigualu/article/details/69787644)| 37.8%| Easy +270| Closest Binary Search Tree Value| 38.8%| Easy +167 |[Two Sum II - Input array is sorted](http://blog.csdn.net/daigualu/article/details/69787679) |47.4%| Easy +441 |[Arranging Coins](http://blog.csdn.net/daigualu/article/details/69788500)| 36.0%| Easy +35| [Search Insert Position](http://blog.csdn.net/daigualu/article/details/66995617)| 39.3%| Easy +374 |Guess Number Higher or Lower |34.4%| Easy +69 |Sqrt(x) |27.4%| Easy| +278| [First Bad Version](http://blog.csdn.net/daigualu/article/details/69802371) |24.8% |Easy +475| Heaters |29.7%| Easy +350 |[Intersection of Two Arrays II](http://blog.csdn.net/daigualu/article/details/69666351) |44.1%| Easy +349| [Intersection of Two Arrays](http://blog.csdn.net/daigualu/article/details/69666198)| 46.5%| Easy \ No newline at end of file diff --git a/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/DataMd/DynamicProgramming.txt.deploy b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/DataMd/DynamicProgramming.txt.deploy new file mode 100644 index 0000000..c3a9b56 --- /dev/null +++ b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/DataMd/DynamicProgramming.txt.deploy @@ -0,0 +1,9 @@ +53| [Maximum Subarray](http://blog.csdn.net/daigualu/article/details/69936974)| 39.2%| Easy| +169| [Majority Element](http://blog.csdn.net/daigualu/article/details/69937729)| 45.6%| Easy| + 303| [Range Sum Query - Immutable](http://blog.csdn.net/daigualu/article/details/69938986)| 27.8%| Easy| +276 |Paint Fence | 34.1%| Easy| +523 |[Continuous Subarray Sum](http://blog.csdn.net/daigualu/article/details/69941770)| 21.6%| Easy| +256| Paint House | 45.9%| Easy| +198| [House Robber](http://blog.csdn.net/daigualu/article/details/69946684)| 38.1%| Easy| +121| Best Time to Buy and Sell Stock|40.1% |Easy| +70| Climbing Stairs |39.2%| Easy| \ No newline at end of file diff --git a/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/DataMd/HashTable.txt.deploy b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/DataMd/HashTable.txt.deploy new file mode 100644 index 0000000..eefacd1 --- /dev/null +++ b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/DataMd/HashTable.txt.deploy @@ -0,0 +1,17 @@ +136 |[Single number](http://blog.csdn.net/daigualu/article/details/68921131) +1| [Two Sum](http://blog.csdn.net/daigualu/article/details/68957096) +447 |[Number of Boomerangs](http://blog.csdn.net/daigualu/article/details/68958818) +463 |[Island Perimeter](http://blog.csdn.net/daigualu/article/details/68959304) +409 |[Longest Palindrome](http://blog.csdn.net/daigualu/article/details/69053267) +438 |[Find All Anagrams in a String](http://blog.csdn.net/daigualu/article/details/71339879) +389 |[Find the Difference](http://blog.csdn.net/daigualu/article/details/71450823) +350 |[Intersection of Two Arrays II](http://blog.csdn.net/daigualu/article/details/69666351) +349 | [Intersection of Two Arrays](http://blog.csdn.net/daigualu/article/details/69666198) +500 |[Keyboard Row](http://blog.csdn.net/daigualu/article/details/71447614) +217| [Contains Duplicate](http://blog.csdn.net/daigualu/article/details/71123673) +204 | [Count Primes](http://blog.csdn.net/daigualu/article/details/71366483) +202 | [Happy Number](http://blog.csdn.net/daigualu/article/details/71433906) +219 |[Contains Duplicate II](http://blog.csdn.net/daigualu/article/details/71166985) +242 |[Valid Anagram](http://blog.csdn.net/daigualu/article/details/71358552) +290 |[Word Pattern](http://blog.csdn.net/daigualu/article/details/71358552) +205 |[Isomorphic Strings](http://blog.csdn.net/daigualu/article/details/71357419) \ No newline at end of file diff --git a/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/DataMd/LinkedList.txt.deploy b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/DataMd/LinkedList.txt.deploy new file mode 100644 index 0000000..9e0a60e --- /dev/null +++ b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/DataMd/LinkedList.txt.deploy @@ -0,0 +1,8 @@ +141 | [Linked List Cycle](http://blog.csdn.net/daigualu/article/details/69055927) +237 | [Delete Node in a Linked List](http://blog.csdn.net/daigualu/article/details/69055991) +83 | [Remove Duplicates from Sorted List](http://blog.csdn.net/daigualu/article/details/69093677) +160 | [Intersection of Two Linked Lists](http://blog.csdn.net/daigualu/article/details/69526717) +203 |[Remove Linked List Elements](http://blog.csdn.net/daigualu/article/details/69389243) +206 | [Reverse Linked List](http://blog.csdn.net/daigualu/article/details/69372119) +234 | [Palindrome Linked List](http://blog.csdn.net/daigualu/article/details/69388513) +21 | [Merge Two Sorted Lists](http://blog.csdn.net/daigualu/article/details/69565969) \ No newline at end of file diff --git a/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/DataMd/Math.txt.deploy b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/DataMd/Math.txt.deploy new file mode 100644 index 0000000..6455862 --- /dev/null +++ b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/DataMd/Math.txt.deploy @@ -0,0 +1,23 @@ +231 | [Power of Two](http://blog.csdn.net/daigualu/article/details/69102931) +268| [Missing Number](http://blog.csdn.net/daigualu/article/details/69220202) +507 | [Perfect Number](http://blog.csdn.net/daigualu/article/details/69233798) +9| [Palindrome Number](http://blog.csdn.net/daigualu/article/details/72717009) +453 | [Minimum Moves to Equal Array Elements](http://blog.csdn.net/daigualu/article/details/72354061) +13 |Roman to Integer +441 |[Arranging Coins]() +415| [Add Strings](http://blog.csdn.net/daigualu/article/details/72356377) +400 |[Nth Digit](http://blog.csdn.net/daigualu/article/details/72572244) +367 |Valid Perfect Square +66| [Plus One](http://blog.csdn.net/daigualu/article/details/71056697) +7| [Reverse Integer](http://blog.csdn.net/daigualu/article/details/72464418) +204 |[Count Primes](http://blog.csdn.net/daigualu/article/details/71366483) +202 |[Happy Number](http://blog.csdn.net/daigualu/article/details/71433906) +172 |Factorial Trailing Zeroes +171 |[Excel Sheet Column Number](http://blog.csdn.net/daigualu/article/details/72717145) +168 |[Excel Sheet Column Title](http://blog.csdn.net/daigualu/article/details/72638706) +258 |Add Digits +263 |Ugly Number +69| [Sqrt(x)](http://blog.csdn.net/daigualu/article/details/72578272) +67 |[Add Binary](http://blog.csdn.net/daigualu/article/details/72638937) +246 |Strobogrammatic Number +326 |Power of Three \ No newline at end of file diff --git a/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/DataMd/Stack.txt.deploy b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/DataMd/Stack.txt.deploy new file mode 100644 index 0000000..0697e91 --- /dev/null +++ b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/DataMd/Stack.txt.deploy @@ -0,0 +1,5 @@ +225|[Implement Stack using Queues](http://blog.csdn.net/daigualu/article/details/70183272)| 32.0%| Easy +496| [Next Greater Element I](http://blog.csdn.net/daigualu/article/details/70185529) |57.5% |Easy +155| [Min Stack](http://blog.csdn.net/daigualu/article/details/70185814)| 27.4%| Easy +232| [Implement Queue using Stacks](http://blog.csdn.net/daigualu/article/details/70186010)| 35.8%| Easy +20| [Valid Parentheses](http://blog.csdn.net/daigualu/article/details/69569622)| 32.9%| Easy \ No newline at end of file diff --git a/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/DataMd/String.txt.deploy b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/DataMd/String.txt.deploy new file mode 100644 index 0000000..0a36c44 --- /dev/null +++ b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/DataMd/String.txt.deploy @@ -0,0 +1,19 @@ +58| [Length of Last Word](http://blog.csdn.net/daigualu/article/details/69568460)| 31.5%| Easy +20 |[Valid Parentheses](http://blog.csdn.net/daigualu/article/details/69569622) |32.8% |Easy +520 |[Detect Capital](http://blog.csdn.net/daigualu/article/details/69663210)| 52.5%| Easy +459 |[Repeated Substring Pattern](http://blog.csdn.net/daigualu/article/details/69663545)| 38.4%| Easy +434 |[Number of Segments in a String](http://blog.csdn.net/daigualu/article/details/69664369) |37.0% |Easy +408 |Valid Word Abbreviation | 27.5% |Easy +13 |Roman to Integer |44.6%| Easy +14 |[Longest Common Prefix](http://blog.csdn.net/daigualu/article/details/69665015) |31.0% |Easy +383 |[Ransom Note](http://blog.csdn.net/daigualu/article/details/69665190) |46.5% |Easy +521 |Longest Uncommon Subsequence I |46.1% |Easy +345 |Reverse Vowels of a String| 37.9% |Easy +28 |Implement strStr() |27.5% |Easy +344 |Reverse String| 58.2%| Easy +293 |Flip Game |54.8% |Easy +38 |Count and Say |33.4% |Easy +157 |Read N Characters Given Read4 | 29.2%| Easy +541 |Reverse String II |44.1% |Easy +125 |Valid Palindrome |25.8% |Easy +67 |Add Binary |31.3% |Easy \ No newline at end of file diff --git a/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/DataMd/Tree.txt.deploy b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/DataMd/Tree.txt.deploy new file mode 100644 index 0000000..ee92dd7 --- /dev/null +++ b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/DataMd/Tree.txt.deploy @@ -0,0 +1,15 @@ +107| [Binary Tree Level Order Traversal II](http://blog.csdn.net/daigualu/article/details/70254459)| 39.0%| Easy +257 |[Binary Tree Paths](http://blog.csdn.net/daigualu/article/details/70340125)| 36.8%| Easy +501 |[Find Mode in Binary Search Tree](http://blog.csdn.net/daigualu/article/details/70341143)| 38.4%| Easy +437 |[Path Sum III](http://blog.csdn.net/daigualu/article/details/70342773)| 39.3% |Easy +404 |[Sum of Left Leaves](http://blog.csdn.net/daigualu/article/details/70482270)| 46.5%| Easy +112 |[Path Sum](http://blog.csdn.net/daigualu/article/details/70482285)| 33.5% |Easy +110 |[Balanced Binary Tree](http://blog.csdn.net/daigualu/article/details/70482667)| 36.8% |Easy +108 |[Convert Sorted Array to Binary Search Tree](http://blog.csdn.net/daigualu/article/details/70485834)| 41.3%| Easy +543 |[Diameter of Binary Tree](http://blog.csdn.net/daigualu/article/details/70491447)| 42.3%| Easy +226 |[Invert Binary Tree](http://blog.csdn.net/daigualu/article/details/70536685)| 50.8%| Easy +235 |[Lowest Common Ancestor of a Binary Search Tree](http://blog.csdn.net/daigualu/article/details/70539096)| 38.5%| Easy +104 |[Maximum Depth of Binary Tree](http://blog.csdn.net/daigualu/article/details/70541420)| 51.7%| Easy +111| [Minimum Depth of Binary Tree](http://blog.csdn.net/daigualu/article/details/70543969)| 32.7% |Easy +101 |[Symmetric Tree](http://blog.csdn.net/daigualu/article/details/70544774)| 37.9%| Easy +100| [Same Tree](http://blog.csdn.net/daigualu/article/details/70254478)| 45.8%| Easy \ No newline at end of file diff --git a/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/DataMd/TwoPointers.txt.deploy b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/DataMd/TwoPointers.txt.deploy new file mode 100644 index 0000000..4934fce --- /dev/null +++ b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/DataMd/TwoPointers.txt.deploy @@ -0,0 +1,14 @@ +345 |[Reverse Vowels of a String](http://blog.csdn.net/daigualu/article/details/69257693) +125 |[Valid Palindrome](http://blog.csdn.net/daigualu/article/details/69265381) +283| [Move Zeroes](http://blog.csdn.net/daigualu/article/details/69329038) +88 |[Merge Sorted Array](http://blog.csdn.net/daigualu/article/details/69367334) +234| [Palindrome Linked List](http://blog.csdn.net/daigualu/article/details/69388513) +349 |Intersection of Two Arrays +167 |[Two Sum II - Input array is sorted](http://blog.csdn.net/daigualu/article/details/69787679) +350| Intersection of Two Arrays II +344| Reverse String +28| Implement strStr() +27 |Remove Element +26| Remove Duplicates from Sorted Array +141| Linked List Cycle +532| K-diff Pairs in an Array \ No newline at end of file diff --git a/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/DataMd/array.txt.deploy b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/DataMd/array.txt.deploy new file mode 100644 index 0000000..f4e3691 --- /dev/null +++ b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/DataMd/array.txt.deploy @@ -0,0 +1,24 @@ +35 |[Search Insert Position](http://blog.csdn.net/daigualu/article/details/66995617) +118| [Pascal's Triangle](http://blog.csdn.net/daigualu/article/details/67006388) +119 |[Pascal's Triangle II](http://blog.csdn.net/daigualu/article/details/67069088) +414| [Third Maximum Number](http://blog.csdn.net/daigualu/article/details/68063481) +121| [Best Time to Buy and Sell Stock](http://blog.csdn.net/daigualu/article/details/71038726) +66| [Plus One](http://blog.csdn.net/daigualu/article/details/71056697) +26 |[Remove Duplicates from Sorted Array](http://blog.csdn.net/daigualu/article/details/71064545) +27| [Remove Element](http://blog.csdn.net/daigualu/article/details/71104482) +122 |[Best Time to Buy and Sell Stock II](http://blog.csdn.net/daigualu/article/details/71104584) +268 |[Missing Number](http://blog.csdn.net/daigualu/article/details/69220202) +217| [Contains Duplicate](http://blog.csdn.net/daigualu/article/details/71123673) +532| [K-diff Pairs in an Array](http://blog.csdn.net/daigualu/article/details/71129806) +189| [Rotate Array](http://blog.csdn.net/daigualu/article/details/71159419) +169 |[Majority Element](http://blog.csdn.net/daigualu/article/details/69937729) +167 |[Two Sum II - Input array is sorted](http://blog.csdn.net/daigualu/article/details/69787679) +88 |[Merge Sorted Array](http://blog.csdn.net/daigualu/article/details/69367334) +53 |[Maximum Subarray](http://blog.csdn.net/daigualu/article/details/69936974) +485 |[Max Consecutive Ones](http://blog.csdn.net/daigualu/article/details/71216338) +283 |[Move Zeroes](http://blog.csdn.net/daigualu/article/details/69329038) +448 |[Find All Numbers Disappeared in an Array](http://blog.csdn.net/daigualu/article/details/71168875) +1| [Two Sum](http://blog.csdn.net/daigualu/article/details/68957096) +219 |[Contains Duplicate II](http://blog.csdn.net/daigualu/article/details/71166985) +566| [Reshape the Matrix](http://blog.csdn.net/daigualu/article/details/71275325) +561| [Array Partition I](http://blog.csdn.net/daigualu/article/details/71273279) \ No newline at end of file diff --git a/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/EntityFramework.SqlServer.dll.deploy b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/EntityFramework.SqlServer.dll.deploy new file mode 100644 index 0000000..481c1c7 Binary files /dev/null and b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/EntityFramework.SqlServer.dll.deploy differ diff --git a/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/EntityFramework.dll.deploy b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/EntityFramework.dll.deploy new file mode 100644 index 0000000..774321a Binary files /dev/null and b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/EntityFramework.dll.deploy differ diff --git a/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/Infragistics2.Shared.v12.1.dll.deploy b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/Infragistics2.Shared.v12.1.dll.deploy new file mode 100644 index 0000000..b2206bc Binary files /dev/null and b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/Infragistics2.Shared.v12.1.dll.deploy differ diff --git a/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/Infragistics2.Win.UltraWinEditors.v12.1.dll.deploy b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/Infragistics2.Win.UltraWinEditors.v12.1.dll.deploy new file mode 100644 index 0000000..7ad6c01 Binary files /dev/null and b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/Infragistics2.Win.UltraWinEditors.v12.1.dll.deploy differ diff --git a/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/Infragistics2.Win.UltraWinGrid.v12.1.dll.deploy b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/Infragistics2.Win.UltraWinGrid.v12.1.dll.deploy new file mode 100644 index 0000000..d167405 Binary files /dev/null and b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/Infragistics2.Win.UltraWinGrid.v12.1.dll.deploy differ diff --git a/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/Infragistics2.Win.v12.1.dll.deploy b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/Infragistics2.Win.v12.1.dll.deploy new file mode 100644 index 0000000..62947ff Binary files /dev/null and b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/Infragistics2.Win.v12.1.dll.deploy differ diff --git a/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/LeetcodeManager.application b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/LeetcodeManager.application new file mode 100644 index 0000000..f787c2d --- /dev/null +++ b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/LeetcodeManager.application @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + ol59qCWK0n90Tk/PKInKhaMrP/Y50Tw9cdatyKKvxtU= + + + +HV2l8c5+3H7ibX8QQUPd3t76MEF6JEEdZ/EjVH0t2jM=CJ8uf7D7hJSvj3BS+hLMknp9dAVFxgecL0P7s1r0PN5uHx9KKefKBq/wC0x0Lavjpg3jTqNb0CV3Pd1G6PkQFFFtEGFbpFEiaTOqUEKkBjdPVPJMtoBZgE7S5OnxMF8XFnfJYOcyMmfbEPI5x8er22DyhyCBHsuQJ6BlobgQ7Rw=wrYka0qN3E5SMpsMaP/W8MFwulEFfPCGk6kb/wx8CvOsse/HrilZh7Pl8rN2FwmL1p0LVkTCoJMsVO0WWnKsmAKpNrkYr8hD/XsGmVrBf9x0qgICwG9qOsTbjqNddEYFvCpqy0iEtTABfUx+sRUL0KiAUYAuBKb6Dspy/zGanck=AQABCN=HaixiaLiu\jackzujmvwnD59KhrjPsLvlKY+o+/KQZQhJsG++2e4x/zjlU=XToC1CHBjQtTGwaffxLkmwnJoEN7fY8Cc9riHaBDa0UEYRiOF/s4C+M1IcAcNJLrBRb5ioSni3EpGYLa11XsgoPQ88tBxWxkk8IAoc4BDfCORmAtvGEHajMPyF0dGTyb75Sco/12R6cntGQrmr52UTYnHA69ofWE6EzigHJ6oeg=wrYka0qN3E5SMpsMaP/W8MFwulEFfPCGk6kb/wx8CvOsse/HrilZh7Pl8rN2FwmL1p0LVkTCoJMsVO0WWnKsmAKpNrkYr8hD/XsGmVrBf9x0qgICwG9qOsTbjqNddEYFvCpqy0iEtTABfUx+sRUL0KiAUYAuBKb6Dspy/zGanck=AQABMIIB1TCCAT6gAwIBAgIQFdfCKXPPzrpH5q41Jk7IBTANBgkqhkiG9w0BAQsFADApMScwJQYDVQQDHh4ASABhAGkAeABpAGEATABpAHUAXABqAGEAYwBrAHowHhcNMTcwNjEwMTEyMTQzWhcNMTgwNjEwMTcyMTQzWjApMScwJQYDVQQDHh4ASABhAGkAeABpAGEATABpAHUAXABqAGEAYwBrAHowgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAMK2JGtKjdxOUjKbDGj/1vDBcLpRBXzwhpOpG/8MfArzrLHvx64pWYez5fKzdhcJi9adC1ZEwqCTLFTtFlpyrJgCqTa5GK/IQ/17BplawX/cdKoCAsBvajrE246jXXRGBbwqastIhLUwAX1MfrEVC9CogFGALgSm+g7Kcv8xmp3JAgMBAAEwDQYJKoZIhvcNAQELBQADgYEAYhg5n6x/urGrrtK96W1/5b5cRPWGyZpusRlvAu9h925QqEPN4Dr0OPVwfPI9F4qvbY0RcHdrUuI9LYJkMdatYgvWvwvI03OKt1F1iS7xBTvlLUApK572d1dMdItg640xGf3WQmblHYUwdUbm3e8sDmlkCMN31gcTGXVoBjtgGuI= \ No newline at end of file diff --git a/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/LeetcodeManager.exe.config.deploy b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/LeetcodeManager.exe.config.deploy new file mode 100644 index 0000000..c427ff1 --- /dev/null +++ b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/LeetcodeManager.exe.config.deploy @@ -0,0 +1,16 @@ + + + + +
+ + + + + + + + + + + diff --git a/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/LeetcodeManager.exe.deploy b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/LeetcodeManager.exe.deploy new file mode 100644 index 0000000..8d2ae29 Binary files /dev/null and b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/LeetcodeManager.exe.deploy differ diff --git a/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/LeetcodeManager.exe.manifest b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/LeetcodeManager.exe.manifest new file mode 100644 index 0000000..d962a28 --- /dev/null +++ b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/LeetcodeManager.exe.manifest @@ -0,0 +1,390 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 7W69dJBS+QGPZplnGuVGmt7fCGz4sb1CVrvpxOf2/wU= + + + + + + + + + + + + ob9snjgg6D9D6fIN19mwozYqkxRvCv4LEzAYXi1RsMs= + + + + + + + + + + + + HsN3pAZOpvOVWVPs5GmSC1H2oLVREQ6RQa9azqMwJIw= + + + + + + + + + + + + D7yckcTnZMPxY4SjZBzY7FfmUodUyqRtynpqaEnhG+A= + + + + + + + + + + + + 3K/Uasx9c0lc920IdalAOLRkyW/Ek9VGvXS5d9FF8jo= + + + + + + + + + + + + 302xCRezIBnhAF6Tc7oGuOzctWsdkSbMCkWs9yaL/FM= + + + + + + + + + + + + Jc5O3Wxl9u4Q41Ba77SV2dcw0ms4n7p5tw+dRHewRHs= + + + + + + + + + + BjwSwgHwig1VSiVOe/s5sZam9eP9iX+37n8Nnilm5jA= + + + + + + + + + HsN3pAZOpvOVWVPs5GmSC1H2oLVREQ6RQa9azqMwJIw= + + + + + + + + + D7yckcTnZMPxY4SjZBzY7FfmUodUyqRtynpqaEnhG+A= + + + + + + + + + 3K/Uasx9c0lc920IdalAOLRkyW/Ek9VGvXS5d9FF8jo= + + + + + + + + + 302xCRezIBnhAF6Tc7oGuOzctWsdkSbMCkWs9yaL/FM= + + + + + + + + + r9MkcRAohukYweQnJTdDDF+zwCXuxoZU6liUdFpYShs= + + + + + + + + + Zyn+CjVkktCHXHhrM170CwMOSerm9KVrhAtav6LSS1w= + + + + + + + + + Mlf/JA1xykPmcCyOB96pDXWbPgWr5j3m9Q5JNhK3lGs= + + + + + + + + + HDdqbOZnSTWB5bASXfo+Lw/nPRPUjSz4qUYubhOLkVY= + + + + + + + + + P+QnS2x4LJYsZtLMNxgWNvNqf6APFdxTlDoSikQTEXU= + + + + + + + + + BVwBgI9KjocMOweLWQMi8JyR3+SsRwAi7qBnvYFqkGM= + + + + + + + + + zrGT4AqV0ExukKvP32uITDcD+BP51j+9GuvySG0OI40= + + + + + + + + + aHQ8cRAuIeF63BFgUQMcCEQnHPXAwiCvEbAvfT9qGP4= + + + + + + + + + J9pln5e/WOoJfbol4gRVOaJl4k3V1UUl7Tie7fpmyiw= + + + + + + + + + OeVgqfxqaEzAyxp5d0CjA/fj+32V080gOL71ozJEdY0= + + + + + + + + + FfwpyyMdr/02ckVVEPqC7SEqR7qDEwvZf6ON4XEWMX4= + + + + + + + + + 9IMitxH7ZQJZxfE/Wgan56qcHQkPo9Z6deLsjOsMUwA= + + + + + + + + + BjwSwgHwig1VSiVOe/s5sZam9eP9iX+37n8Nnilm5jA= + + + + + + + + + Qmq27pW9T1vSxHmHnwI2AMG/TG092fVkThMmwxzrn1w= + + + + + + + + + 6nHbQkzsl6K62tohKu0FQqzVjW8gRMSTCFMwPitTIBo= + + + + + + + + + EoaUcHo1ceH2an7F4V9lblXKKryJ6X0fp/ihmoamg9c= + + + + + + + + + 2Uv9k06eOzJ1tcrrvbkEK20tXtWb3FcJVtpzo09obfI= + + + + + + + + + m1yD0Wanxjb9Av5wkfg+tBg5Uw7bvAhAYwwepfqEHo0= + + + + + + + + + agC+8Q5tEFy+ZnikrtC5kQviLwc/Q5GOjGMv5IuhRKc= + + + + + + + + + 35x2AkRAzR57vExrhNzrISRiUuL89Dkd+wp6GHtaGHU= + + + + + + + + + 86ffZguV696jIdLzTKO6dt6+hnRh4NWDf8PQ60QprVk= + + + + + + + + + LFOELQ7h7smG2q2toqfAPgYw9v6yRSEZzP8bK1H1/aI= + + + + + + + + + fGGfsI0lVDQmbknnpyFZ0CT6HhXoEKr8CnAB+kIqyQE= + + + + + + + + + se1hAXMitN5Qsin1mWLSI2wMUbGB+Rf+EbDpIP5fkFo= + + +Mz7Vgtp7cZey/tBzgx9qYKIzMvnwfuHKFlw5OTDQC1o=LrQN0vm+L9YVfcARlN4X4aRVwn4KLTzB6NfLk0E8e607ebp47CL8mmgstbzvEHjrM2uiAcGj/xPG94XSNuJRKK8R3xnZVRB2/MFAYDCcUQZz3D723NH5J/4NxoAplmO3rhZJng8MPnWaPMhImsU/Ewo4pwobsqU/6jBtbt0y4sc=wrYka0qN3E5SMpsMaP/W8MFwulEFfPCGk6kb/wx8CvOsse/HrilZh7Pl8rN2FwmL1p0LVkTCoJMsVO0WWnKsmAKpNrkYr8hD/XsGmVrBf9x0qgICwG9qOsTbjqNddEYFvCpqy0iEtTABfUx+sRUL0KiAUYAuBKb6Dspy/zGanck=AQABCN=HaixiaLiu\jackzViNcFb5oVQgEnmJ+660M9vodY5KB8e85+rIVYTcWQPo=q/bNTT27y51YQzzjBtC85/BPndrvvpG53xMFhvXh1Vw6DW0rSDIy79p4kxl75dBPJeE3w60cSBavpxrRlbLfH3nQvySxdwM2FsJOYB9NLBRo12G1xy5AfH3HyEMzJK5MMsAa8Srun8VNS+y3WAZpBuKNo22+1HSoZH6D9sWfqZc=wrYka0qN3E5SMpsMaP/W8MFwulEFfPCGk6kb/wx8CvOsse/HrilZh7Pl8rN2FwmL1p0LVkTCoJMsVO0WWnKsmAKpNrkYr8hD/XsGmVrBf9x0qgICwG9qOsTbjqNddEYFvCpqy0iEtTABfUx+sRUL0KiAUYAuBKb6Dspy/zGanck=AQABMIIB1TCCAT6gAwIBAgIQFdfCKXPPzrpH5q41Jk7IBTANBgkqhkiG9w0BAQsFADApMScwJQYDVQQDHh4ASABhAGkAeABpAGEATABpAHUAXABqAGEAYwBrAHowHhcNMTcwNjEwMTEyMTQzWhcNMTgwNjEwMTcyMTQzWjApMScwJQYDVQQDHh4ASABhAGkAeABpAGEATABpAHUAXABqAGEAYwBrAHowgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAMK2JGtKjdxOUjKbDGj/1vDBcLpRBXzwhpOpG/8MfArzrLHvx64pWYez5fKzdhcJi9adC1ZEwqCTLFTtFlpyrJgCqTa5GK/IQ/17BplawX/cdKoCAsBvajrE246jXXRGBbwqastIhLUwAX1MfrEVC9CogFGALgSm+g7Kcv8xmp3JAgMBAAEwDQYJKoZIhvcNAQELBQADgYEAYhg5n6x/urGrrtK96W1/5b5cRPWGyZpusRlvAu9h925QqEPN4Dr0OPVwfPI9F4qvbY0RcHdrUuI9LYJkMdatYgvWvwvI03OKt1F1iS7xBTvlLUApK572d1dMdItg640xGf3WQmblHYUwdUbm3e8sDmlkCMN31gcTGXVoBjtgGuI= \ No newline at end of file diff --git a/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/Resources/1.bmp.deploy b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/Resources/1.bmp.deploy new file mode 100644 index 0000000..5974666 Binary files /dev/null and b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/Resources/1.bmp.deploy differ diff --git a/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/Resources/1.ico.deploy b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/Resources/1.ico.deploy new file mode 100644 index 0000000..57e76d1 Binary files /dev/null and b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/Resources/1.ico.deploy differ diff --git a/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/Resources/10.png.deploy b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/Resources/10.png.deploy new file mode 100644 index 0000000..dc5ef12 Binary files /dev/null and b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/Resources/10.png.deploy differ diff --git a/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/Resources/11.png.deploy b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/Resources/11.png.deploy new file mode 100644 index 0000000..21ba87d Binary files /dev/null and b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/Resources/11.png.deploy differ diff --git a/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/Resources/2.bmp.deploy b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/Resources/2.bmp.deploy new file mode 100644 index 0000000..5ee0f71 Binary files /dev/null and b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/Resources/2.bmp.deploy differ diff --git a/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/Resources/3.bmp.deploy b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/Resources/3.bmp.deploy new file mode 100644 index 0000000..6207fef Binary files /dev/null and b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/Resources/3.bmp.deploy differ diff --git a/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/Resources/4.bmp.deploy b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/Resources/4.bmp.deploy new file mode 100644 index 0000000..a797d3e Binary files /dev/null and b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/Resources/4.bmp.deploy differ diff --git a/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/Resources/5.bmp.deploy b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/Resources/5.bmp.deploy new file mode 100644 index 0000000..1a8da59 Binary files /dev/null and b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/Resources/5.bmp.deploy differ diff --git a/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/Resources/6.bmp.deploy b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/Resources/6.bmp.deploy new file mode 100644 index 0000000..b013778 Binary files /dev/null and b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/Resources/6.bmp.deploy differ diff --git a/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/Resources/7.bmp.deploy b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/Resources/7.bmp.deploy new file mode 100644 index 0000000..56ce945 Binary files /dev/null and b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/Resources/7.bmp.deploy differ diff --git a/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/Resources/8.bmp.deploy b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/Resources/8.bmp.deploy new file mode 100644 index 0000000..f2a3c7d Binary files /dev/null and b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/Resources/8.bmp.deploy differ diff --git a/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/Resources/delAll.bmp.deploy b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/Resources/delAll.bmp.deploy new file mode 100644 index 0000000..f66a3b4 Binary files /dev/null and b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/Resources/delAll.bmp.deploy differ diff --git a/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/Resources/edit.bmp.deploy b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/Resources/edit.bmp.deploy new file mode 100644 index 0000000..673ccaf Binary files /dev/null and b/LeetCodeTool/Application Files/LeetcodeManager_1_1_2_20/Resources/edit.bmp.deploy differ diff --git a/LeetCodeTool/LeetCodeTool-V1.1.zip b/LeetCodeTool/LeetCodeTool-V1.1.zip new file mode 100644 index 0000000..ed450d7 Binary files /dev/null and b/LeetCodeTool/LeetCodeTool-V1.1.zip differ diff --git a/LeetCodeTool/LeetcodeManager.application b/LeetCodeTool/LeetcodeManager.application new file mode 100644 index 0000000..f787c2d --- /dev/null +++ b/LeetCodeTool/LeetcodeManager.application @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + ol59qCWK0n90Tk/PKInKhaMrP/Y50Tw9cdatyKKvxtU= + + + +HV2l8c5+3H7ibX8QQUPd3t76MEF6JEEdZ/EjVH0t2jM=CJ8uf7D7hJSvj3BS+hLMknp9dAVFxgecL0P7s1r0PN5uHx9KKefKBq/wC0x0Lavjpg3jTqNb0CV3Pd1G6PkQFFFtEGFbpFEiaTOqUEKkBjdPVPJMtoBZgE7S5OnxMF8XFnfJYOcyMmfbEPI5x8er22DyhyCBHsuQJ6BlobgQ7Rw=wrYka0qN3E5SMpsMaP/W8MFwulEFfPCGk6kb/wx8CvOsse/HrilZh7Pl8rN2FwmL1p0LVkTCoJMsVO0WWnKsmAKpNrkYr8hD/XsGmVrBf9x0qgICwG9qOsTbjqNddEYFvCpqy0iEtTABfUx+sRUL0KiAUYAuBKb6Dspy/zGanck=AQABCN=HaixiaLiu\jackzujmvwnD59KhrjPsLvlKY+o+/KQZQhJsG++2e4x/zjlU=XToC1CHBjQtTGwaffxLkmwnJoEN7fY8Cc9riHaBDa0UEYRiOF/s4C+M1IcAcNJLrBRb5ioSni3EpGYLa11XsgoPQ88tBxWxkk8IAoc4BDfCORmAtvGEHajMPyF0dGTyb75Sco/12R6cntGQrmr52UTYnHA69ofWE6EzigHJ6oeg=wrYka0qN3E5SMpsMaP/W8MFwulEFfPCGk6kb/wx8CvOsse/HrilZh7Pl8rN2FwmL1p0LVkTCoJMsVO0WWnKsmAKpNrkYr8hD/XsGmVrBf9x0qgICwG9qOsTbjqNddEYFvCpqy0iEtTABfUx+sRUL0KiAUYAuBKb6Dspy/zGanck=AQABMIIB1TCCAT6gAwIBAgIQFdfCKXPPzrpH5q41Jk7IBTANBgkqhkiG9w0BAQsFADApMScwJQYDVQQDHh4ASABhAGkAeABpAGEATABpAHUAXABqAGEAYwBrAHowHhcNMTcwNjEwMTEyMTQzWhcNMTgwNjEwMTcyMTQzWjApMScwJQYDVQQDHh4ASABhAGkAeABpAGEATABpAHUAXABqAGEAYwBrAHowgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAMK2JGtKjdxOUjKbDGj/1vDBcLpRBXzwhpOpG/8MfArzrLHvx64pWYez5fKzdhcJi9adC1ZEwqCTLFTtFlpyrJgCqTa5GK/IQ/17BplawX/cdKoCAsBvajrE246jXXRGBbwqastIhLUwAX1MfrEVC9CogFGALgSm+g7Kcv8xmp3JAgMBAAEwDQYJKoZIhvcNAQELBQADgYEAYhg5n6x/urGrrtK96W1/5b5cRPWGyZpusRlvAu9h925QqEPN4Dr0OPVwfPI9F4qvbY0RcHdrUuI9LYJkMdatYgvWvwvI03OKt1F1iS7xBTvlLUApK572d1dMdItg640xGf3WQmblHYUwdUbm3e8sDmlkCMN31gcTGXVoBjtgGuI= \ No newline at end of file diff --git a/LeetCodeTool/LeetcodeManager_TemporaryKey.pfx b/LeetCodeTool/LeetcodeManager_TemporaryKey.pfx new file mode 100644 index 0000000..a461c9d Binary files /dev/null and b/LeetCodeTool/LeetcodeManager_TemporaryKey.pfx differ diff --git a/LeetCodeTool/setup.exe b/LeetCodeTool/setup.exe new file mode 100644 index 0000000..67925d0 Binary files /dev/null and b/LeetCodeTool/setup.exe differ diff --git a/Math/.vs/Math/v15/.suo b/Math/.vs/Math/v15/.suo new file mode 100644 index 0000000..2f1870c Binary files /dev/null and b/Math/.vs/Math/v15/.suo differ diff --git a/Math/Math.Lib/AddBinarySln.cs b/Math/Math.Lib/AddBinarySln.cs new file mode 100644 index 0000000..3165d90 --- /dev/null +++ b/Math/Math.Lib/AddBinarySln.cs @@ -0,0 +1,54 @@ +/* ============================================================================== + * 功能描述:AddBinary + * 创 建 者:gz + * 创建日期:2017/5/23 12:57:28 + * ==============================================================================*/ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Math.Lib +{ + // Given two binary strings, return their sum (also a binary string). + //For example, + //a = "11" + //b = "1" + //Return "100". + /// + /// AddBinary + /// + public class AddBinarySln + { + public string AddBinary(string a, string b) + { + StringBuilder sb = new StringBuilder(); + int carry = 0, acnt = a.Length, bcnt = b.Length; + for (int i = acnt - 1, j = bcnt - 1; i >= 0 || j >= 0 || carry == 1; i--, j--){ + int sum2 = 0; + if (i < 0 && j < 0){ //overflow solving + sb.Append(carry); + carry = 0; + continue; + } + //discuss three conditions according to i and j + if (i < 0) sum2 = b[j] - '0'; + else if (j < 0) sum2 = a[i] - '0'; + else sum2 = a[i] - '0' + b[j] - '0'; + if (sum2 + carry < 2){ + sb.Append(sum2 + carry); + carry = 0; + } + else { + sb.Append(sum2 + carry - 2); + carry = 1; + } + } + //reverse the sb + IEnumerable rtnchars = sb.ToString().Reverse(); + sb.Clear(); + foreach (var ch in rtnchars) sb.Append(ch); + return sb.ToString(); + } + } +} diff --git a/Math/Math.Lib/AddDigitsSln.cs b/Math/Math.Lib/AddDigitsSln.cs new file mode 100644 index 0000000..508c7af --- /dev/null +++ b/Math/Math.Lib/AddDigitsSln.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +// // 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 only one digit, return it. + +// // Follow up: +// // Could you do it without any loop/recursion in O(1) runtime? +namespace Math.Lib +{ + public class AddDigitsSln + { + public int AddDigits(int num) { + return num - 9*Convert.ToInt32((num-1)/9); + } + } + +} diff --git a/Math/Math.Lib/AddStringsSln.cs b/Math/Math.Lib/AddStringsSln.cs new file mode 100644 index 0000000..1ea91cd --- /dev/null +++ b/Math/Math.Lib/AddStringsSln.cs @@ -0,0 +1,40 @@ +/* ============================================================================== + * 功能描述:AddStringsSln + * 创 建 者:gz + * 创建日期:2017/5/17 8:59:06 + * ==============================================================================*/ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace test +{ + /// + /// AddStringsSln + /// + public class AddStringsSln + { + public string AddStrings(string num1, string num2) + { + StringBuilder sb = new StringBuilder(); + int carryBit = 0; //carry bit + for (int i = num1.Length - 1, j = num2.Length - 1; + i >= 0 || j >= 0 || carryBit == 1; i--, j--) //think: num1=3, num2=9 + { + int x = i < 0 ? 0 : charToInt(num1[i]); + int y = j < 0 ? 0 : charToInt(num2[j]); + sb.Append((x + y + carryBit) % 10); + carryBit = (x + y + carryBit) / 10; + } + char[] chars = sb.ToString().Reverse().ToArray(); + return new string(chars); + } + + private int charToInt(char c) + { + return c - '0'; + } + + } +} diff --git a/Math/Math.Lib/ExcelColumnNumberSln.cs b/Math/Math.Lib/ExcelColumnNumberSln.cs new file mode 100644 index 0000000..230165a --- /dev/null +++ b/Math/Math.Lib/ExcelColumnNumberSln.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Math.Lib +{ + public class ExcelColumnNumberSln + { + public int TitleToNumber(string s) + { + char[] chs= {'A','B','C','D','E','F','G','H','I','J','K', + 'L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'}; + Dictionary dict = new Dictionary(); + for(int i=0; i= 0; i--,j++) + rtnsum += dict[s[i]] * (int)System.Math.Pow(26, j); + return rtnsum; + } + } +} diff --git a/Math/Math.Lib/ExcelColumnTitle.cs b/Math/Math.Lib/ExcelColumnTitle.cs new file mode 100644 index 0000000..30e68f1 --- /dev/null +++ b/Math/Math.Lib/ExcelColumnTitle.cs @@ -0,0 +1,39 @@ +/* ============================================================================== + * 功能描述:Class1 + * 创 建 者:gz + * 创建日期:2017/5/23 12:49:30 + * ==============================================================================*/ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Math.Lib +{ + /// + /// ExcelColumnTitle + /// + public class ExcelColumnTitle + { + public string ConvertToTitle(int n) + { + //A~Z:26 + //AA~ZZ:26*26 + //... + if (n == 1) return "A"; + char[] chdict = {'A','B','C','D','E','F','G','H','I','J','K', 'L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'}; + StringBuilder sb = new StringBuilder(); + while (n > 0) + { + n--; //beacuse our chdict's index begins Zero. + sb.Append(chdict[n % 26]); + n = n / 26; + } + IEnumerable rtnchars = sb.ToString().Reverse(); + sb.Clear(); + foreach (var ch in rtnchars) sb.Append(ch); + return sb.ToString(); + } + + } +} diff --git a/Math/Math.Lib/ExlColumnTitleSln.cs b/Math/Math.Lib/ExlColumnTitleSln.cs new file mode 100644 index 0000000..bee248e --- /dev/null +++ b/Math/Math.Lib/ExlColumnTitleSln.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Math.Lib +{ + // Given a positive integer, return its corresponding column title as appear in an Excel sheet. + + //For example: + + // 1 -> A + // 2 -> B + // 3 -> C + // ... + // 26 -> Z + // 27 -> AA + // 28 -> AB + public class ExlColumnTitleSln + { + public string ConvertToTitle(int n) + { + //A~Z:26 + //AA~ZZ:26*26 + //... + if (n == 0) return "A"; + char[] chdict = new char[]{'A','B','C','D','E','F','G','H','I','J','K', + 'L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'}; + StringBuilder sb = new StringBuilder(); + while (n > 0) + { + if (n % 26 == 0) + sb.Append('Z'); + else sb.Append(chdict[n % 26 - 1]); + n = n / 26; + } + IEnumerable rtnchars = sb.ToString().Reverse(); + sb.Clear(); + foreach (var ch in rtnchars) + sb.Append(ch); + return sb.ToString(); + } + } +} diff --git a/Math/Math.Lib/HappyNumber.cs b/Math/Math.Lib/HappyNumber.cs index d661ec3..ef97889 100644 --- a/Math/Math.Lib/HappyNumber.cs +++ b/Math/Math.Lib/HappyNumber.cs @@ -10,16 +10,16 @@ namespace Math.Lib { - Write an algorithm to determine if a number is "happy". +// 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 of its digits, and repeat the process until the number equals 1 (where it will stay), or it loops endlessly in a cycle which does not include 1. Those numbers for which this process ends in 1 are happy numbers. +//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 of its digits, and repeat the process until the number equals 1 (where it will stay), or it loops endlessly in a cycle which does not include 1. Those numbers for which this process ends in 1 are happy numbers. -Example: 19 is a happy number +//Example: 19 is a happy number -1^2 + 9^2 = 82 -8^2 + 2^2 = 68 -6^2 + 8^2 = 100 -1^2 + 0^2 + 0^2 = 1 +//1^2 + 9^2 = 82 +//8^2 + 2^2 = 68 +//6^2 + 8^2 = 100 +//1^2 + 0^2 + 0^2 = 1 public class HappyNumberSln { public bool IsHappy(int n) { int slow =n, fast = n; diff --git a/Math/Math.Lib/IssPalindromeSln.cs b/Math/Math.Lib/IssPalindromeSln.cs new file mode 100644 index 0000000..16f2e66 --- /dev/null +++ b/Math/Math.Lib/IssPalindromeSln.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Math.Lib +{ + public class IssPalindromeSln + { + public bool IsPalindrome(int x) + { + int palindromex = 0, tmp = x; + int sumbit = 0; + //calcuate bit count + while (tmp > 0) + { + sumbit++; + tmp /= 10; + } + tmp = x; + //get a number reversely + while (tmp > 0) + { + //if palindromex happens overflow, it would return false; + palindromex += tmp % 10 * (int)System.Math.Pow(10, --sumbit); + tmp /= 10; + } + return palindromex == x; + } + } +} diff --git a/Math/Math.Lib/Math.Lib.csproj b/Math/Math.Lib/Math.Lib.csproj index 499c74b..1f61c5f 100644 --- a/Math/Math.Lib/Math.Lib.csproj +++ b/Math/Math.Lib/Math.Lib.csproj @@ -40,10 +40,23 @@ + + + + + + + + + + + + +