- 博客(77)
- 收藏
- 关注
原创 Leetcode算法学习日志-144 Binary Tree Preorder Traversal
Leetcode 144 Binary Tree Preorder Traversal题目原文Given a binary tree, return the preorder traversal of its nodes' values.题意分析先根次序输出一棵树解法分析先根次序输出一棵树最常见的办法是采用递归,本题要求利用迭代的方法。要将递归转为迭代,关键是要控制迭代变量,并且注意维护一个sta...
2018-03-07 22:16:42 422
原创 Leetcode算法学习日志-494 Target Sum
Leetcode 494 Target Sum题目原文You are given a list of non-negative integers, a1, a2, ..., an, and a target, S. Now you have 2 symbols+ and -. For each integer, you should choose one from + and
2018-02-06 10:45:50 477
原创 Leetcode算法学习日志-287 Find the Duplicate Number
Leetcode 287 Find the Duplicate Number题目原文Given an array nums containing n + 1 integers where each integer is between 1 andn (inclusive), prove that at least one duplicate number must exist. A
2018-01-31 10:55:58 425
原创 伪随机序列相关知识
伪随机序列相关知识m序列是采用LFSR生成的伪随机序列,一个n级LFSR如果共有2^n-1种输出状态,全0状态除外,则它能生成一个周期为2^n-1的小m序列,同时如果只看n级移位寄存器中的状态,则总共有2^n-1种状态,可见如果将初始状态作为输入,输出为移位后的状态,则该LFSR是一个permutation,即一个集合到自身的双射。由于对于1-(2^n-1)这些数,奇数比偶数多一个,因此m
2018-01-28 10:28:53 9006
原创 Leetcode算法学习日志-735 Asteroid Collision
Leetcode 735 Asteroid Collision题目原文We are given an array asteroids of integers representing asteroids in a row.For each asteroid, the absolute value represents its size, and the sign represent
2018-01-26 10:16:57 772
原创 Leetcode算法学习日志-738 Monotone Increasing Digits
Leetcode 738 Monotone Increasing Digits题目原文Given a non-negative integer N, find the largest number that is less than or equal toN with monotone increasing digits.(Recall that an integer has
2018-01-24 11:39:58 391
原创 Leetcode算法学习日志-767 Reorganize String
Leetcode 767 Reorganize String题目原文Given a string S, check if the letters can be rearranged so that two characters that are adjacent to each other are not the same.If possible, output any possi
2018-01-22 11:35:58 1176
原创 Leetcode算法学习日志-743 Network Delay Time
Leetcode 743 Network Delay Time题目原文There are N network nodes, labelled 1 to N.Given times, a list of travel times asdirected edges times[i] = (u, v, w), where u is the source node,v is t
2018-01-22 11:15:03 811
原创 Leetcode算法学习日志-748 Shortest Completing Word
Leetcode 748 Shortest Completing Word题目原文Find the minimum length word from a given dictionary words, which has all the letters from the string licensePlate. Such a word is said to complete the given
2018-01-17 20:47:22 448
原创 Leetcode算法学习日志-687 Longest Univalue Path
Leetcode 687 Longest Univalue Path题目原文Given a binary tree, find the length of the longest path where each node in the path has the same value. This path may or may not pass through the root.No
2018-01-14 10:11:12 822
原创 Leetcode算法学习日志-686 Repeated String Match
Leetcode 686 Repeated String Match题目原文Given two strings A and B, find the minimum number of times A has to be repeated such that B is a substring of it. If no such solution, return -1.For
2018-01-13 11:16:33 489
原创 Topcoder SRM 727 TwoDiagonals
Topcoder SRM 727 TwoDiagonals题目原文Bearland can be represented as a horizontal plane with N distinct points, denoting positions of N cities.The i-th city has coordinates (x[i],y[i]).Limak
2018-01-11 20:44:19 618
原创 Leetcode算法学习日志-486 Predict the Winner
Leetcode 486 Predict the Winner题目原文Given an array of scores that are non-negative integers. Player 1 picks one of the numbers from either end of the array followed by the player 2 and then playe
2018-01-09 14:42:51 436
原创 Leetcode算法学习日志-496 Next Greater Element
Leetcode 496 Next Greater Element题目原文You are given two arrays (without duplicates)nums1 and nums2 where nums1’s elements are subset ofnums2. Find all the next greater numbers for nums1's ele
2018-01-05 11:42:30 411
原创 hiho一下183周 Counting Island II
hiho一下183周 Counting Island II题目原文Country H is going to carry out a huge artificial islands project. The project region is divided into a 1000x1000 grid. The whole project will last forN we
2018-01-03 15:32:56 385
原创 布尔函数代数标准型的求法
布尔函数的代数标准型布尔函数的小项表示布尔函数的小项表示可以由真值表直接得出,最小项表示如下:其中ai为0表示xi取反,每个最小项的系数为对应真值表的值,可知x的每个状态只能使得唯一一个最小项为1,其余都为0,注意上式中只有与、或、非三种逻辑运算,由于各个最小项不能同时为1,所以上述或运算可以和异或等同(二进制加等同异或运算)。上式其实就为平时我们从真值表直接得
2017-12-28 15:52:40 8048 1
原创 Codechef Wonder Woman and the Dark man
Codechef Wonder Woman and the Dark man题目原文InputThe first line contains 'N' number of numbers formed by the magic cave followed by the sequence of those numbers A1,A2,A3,…AnOutputPrint
2017-12-28 10:18:00 419
原创 Leetcode算法学习日志-752 Open the Lock
Leetcode 752 Open the Lock题目原文You have a lock in front of you with 4 circular wheels. Each wheel has 10 slots:'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'. The wheels can rotate freely and
2017-12-27 14:10:55 1576
原创 Leetcode算法学习日志-751 IP to CIDR
Leetcode 751 IP to CIDR题目原文Given a start IP address ip and a number of ips we need to covern, return a representation of the range as a list (of smallest possible length) of CIDR blocks.A CI
2017-12-27 11:29:45 1710
原创 Atcoder wide flip解题报告
Atcoder wide flip题目原文You are given a string S consisting of0 and 1.Find the maximum integer K not greater than|S| such that we can turn all the characters ofS into0 by repeating the fo
2017-12-26 16:08:50 959
原创 Atcoder FT robot解题报告
Atcoder FT robot解题报告题目原文A robot is put at the origin in a two-dimensional plane.Initially, the robot is facing in the positivex-axis direction.This robot will be given an instruction seque
2017-12-26 10:35:30 852
原创 Leetcode算法学习日志-257 Binary Tree Paths
Leetcode 257 Binary Tree Paths题目原文Given a binary tree, return all root-to-leaf paths.For example, given the following binary tree: 1 / \2 3 \ 5All root-to-leaf paths are:["
2017-12-20 11:55:21 326
原创 Leetcode算法学习日志-718 Maximum Length of Repeated Subarray
Leetcode 718 Maximum Length of Repeated Subarray题目原文Given two integer arrays A and B, return the maximum length of an subarray that appears in both arrays.Example 1:Input:A: [1,2,3,2,1]
2017-12-19 12:32:27 344
原创 Leetcode算法学习日志-315 Count of Small Numbers After Self
Leetcode 315 Count of Small Numbers After Self题目原文You are given an integer array nums and you have to return a newcounts array.The counts array has the property where counts[i] is the number
2017-12-18 12:34:41 361
原创 Leetcode算法学习日志-437 Path Sum III
Leetcode 437 Path Sum III题目原文You are given a binary tree in which each node contains an integer value.Find the number of paths that sum to a given value.The path does not need to start or en
2017-12-13 10:50:20 311
原创 Leetcode算法学习日志-48 Rotate Image
Leetcode 48 Rotate Image题目原文You are given an n x n 2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Note:You have to rotate the image in-place, which means you ha
2017-12-13 10:22:47 270
原创 Leetcode算法学习日志-684 Redundant Connection
Leetcode 684 Redundant Connection题目原文In this problem, a tree is an undirected graph that is connected and has no cycles.The given input is a graph that started as a tree with N nodes (with dis
2017-12-10 16:44:48 568
原创 Leetcode算法学习日志-720 Longest Word in Dictionary
Leetcode 720 Longest Word in Dictionary题目原文Given a list of strings words representing an English Dictionary, find the longest word inwords that can be built one character at a time by other wo
2017-12-05 11:07:52 1538
原创 Leetcode算法学习日志-572 Subtree of Another Tree
Leetcode 572 Subtree of Another Tree题目原文Given two non-empty binary trees s andt, check whether tree t has exactly the same structure and node values with a subtree ofs. A subtree of s is a t
2017-12-04 20:43:39 356
原创 Leetcode算法学习日志-594 Longest Harmonious Subsequence
Leetcode 594 Longest Harmonious Subsequence题目原文We define a harmonious array is an array where the difference between its maximum value and its minimum value isexactly 1.Now, given an integer
2017-12-04 20:33:29 346
原创 Leetcode算法学习日志-737 Sentence Similarity II
Leetcode 737 Sentence Similarity题目原文Given two sentences words1, words2 (each represented as an array of strings), and a list of similar word pairspairs, determine if two sentences are similar.
2017-12-03 21:39:34 1607
原创 Leetcode算法学习日志-525 Contiguous Array
Leetcode 525 Contiguous Array题目原文Given a binary array, find the maximum length of a contiguous subarray with equal number of 0 and 1.Example 1:Input: [0,1]Output: 2Explanation: [0, 1]
2017-12-02 17:01:45 408
原创 Leetcode算法学习日志-202 Happy Number
Leetcode 202 Happy Number题目原文Write an algorithm to determine if a number is "happy".A happy number is a number defined by the following process: Starting with any positive integer, replace the
2017-11-23 11:47:13 383
原创 Leetcode算法学习日志-309 Best Time to Buy and Sell Stock with Cooldown
Leetcode 309 Best Time to Buy and Sell Stock with Cooldown题目原文Say you have an array for which the ith element is the price of a given stock on dayi.Design an algorithm to find the maximum pr
2017-11-22 20:38:57 333
原创 Leetcode算法学习日志-436 Find Right Interval
Leetcode 436 Find Right Interval题目原文Given a set of intervals, for each of the interval i, check if there exists an interval j whose start point is bigger than or equal to the end point of the in
2017-11-21 21:42:07 677 1
原创 Leetcode算法学习日志-399 Evaluate Division
Leetcode 399 Evaluate Division题目原文Equations are given in the format A / B = k, whereA and B are variables represented as strings, and k is a real number (floating point number). Given some q
2017-11-19 16:06:14 631
原创 Leetcode算法学习日志-89 Gray Code
Leetcode 89 Gray Code题目原文The gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integer n representing the total number of bits in the
2017-11-15 22:03:24 325
原创 Leetcode算法学习日志-394 Decode String
Leetcode 394 Decode String题目原文Given an encoded string, return it's decoded string.The encoding rule is: k[encoded_string], where theencoded_string inside the square brackets is being repeate
2017-11-15 11:39:44 443
原创 编码理论中所需代数知识总结
编码理论中所需代数知识总结一、群1、一个定义了二元运算*的集合G如果满足如下条件,则称之为群。二元运算*满足结合律存在单位元e,使得a*e=e*a=a对于G中任意元素a,存在逆元a‘,使得a*a'=a'*a=e如果二元运算*满足交换律,则上述群是交换群(abel群),如不满足二三条,称为半群,如还满足交换律,称为交换半群2、群的单位元和逆元都是唯一的。3、集合G中的元素不一
2017-11-14 21:12:02 2659
原创 Leetcode算法学习日志-386 Lexicographical Numbers
Leetcode 386 Lexicographical Numbers题目原文Given an integer n, return 1 - n in lexicographical order.For example, given 13, return: [1,10,11,12,13,2,3,4,5,6,7,8,9].Please optimize your algorith
2017-11-14 15:09:51 375
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人