2019年2月25日

摘要: Given an integer array, you need to find one continuous subarray that if you only sort this subarray in ascending order, then the whole array will be 阅读全文
posted @ 2019-02-25 22:23 Albert67 阅读(144) 评论(0) 推荐(0) 编辑
 
摘要: https://codeforces.com/contest/1131/problem/F 阅读全文
posted @ 2019-02-25 20:26 Albert67 阅读(127) 评论(0) 推荐(0) 编辑

2019年2月22日

摘要: Given a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacen 阅读全文
posted @ 2019-02-22 17:36 Albert67 阅读(114) 评论(0) 推荐(0) 编辑
 
摘要: Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists. Example: 阅读全文
posted @ 2019-02-22 16:55 Albert67 阅读(65) 评论(0) 推荐(0) 编辑
 
摘要: Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. push(x) -- Push element x onto stack. pop() -- Remov 阅读全文
posted @ 2019-02-22 15:37 Albert67 阅读(132) 评论(0) 推荐(0) 编辑
 
摘要: https://codeforces.com/contest/1113/problem/B 思想不难,但是在比较大小的时候,我选择了很笨的方法,我用两个数变化之后的差值大小来进行选择,然后最后再进行数组的更改,最后求和。 实际上,可以先求和,在每次运算之前,减去两个数,然后再把处理后的两个数加上,比 阅读全文
posted @ 2019-02-22 12:23 Albert67 阅读(201) 评论(0) 推荐(0) 编辑
 
摘要: https://codeforces.com/contest/1106/problem/D 题意:求出字典序最小的走法 解法:走到每个点,都选取与这个点连通的序号最小的点,并且这个序号最小的点没有被访问过。 阅读全文
posted @ 2019-02-22 10:34 Albert67 阅读(154) 评论(0) 推荐(0) 编辑
 
摘要: https://leetcode.com/problems/path-sum-iii/ 理解比较困难,可以先看https://www.cnblogs.com/albert67/p/10416402.html 递归比较慢,但很容易理解 阅读全文
posted @ 2019-02-22 09:47 Albert67 阅读(118) 评论(0) 推荐(0) 编辑
 
摘要: https://www.geeksforgeeks.org/number-subarrays-sum-exactly-equal-k/ 讲解的详细 看这道题是为了解决https://leetcode.com/problems/path-sum-iii/ 阅读全文
posted @ 2019-02-22 09:21 Albert67 阅读(126) 评论(0) 推荐(0) 编辑

2019年2月21日

摘要: https://codeforces.com/contest/1118/problem/C 在查找元素的时候,必须按4,2,1的顺序进行。因为,如果先找1,可能就把原来的4拆散了,然后再找4,就找不到了 阅读全文
posted @ 2019-02-21 21:57 Albert67 阅读(177) 评论(0) 推荐(0) 编辑