2021年9月7日

摘要: class Solution { public: vector<int> searchRange(vector<int>& nums, int target) { if(nums.size()==0) return vector<int> {-1,-1}; int l,r,mid; l=0,r =  阅读全文
posted @ 2021-09-07 15:57 gnftau 阅读(23) 评论(0) 推荐(0) 编辑

2020年1月29日

摘要: A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in moving a product from supplier to customer 阅读全文
posted @ 2020-01-29 12:16 gnftau 阅读(176) 评论(0) 推荐(0) 编辑

2020年1月22日

摘要: There is a public bike service in Hangzhou City which provides great convenience to the tourists from all over the world. One may rent a bike at any s 阅读全文
posted @ 2020-01-22 16:25 gnftau 阅读(178) 评论(0) 推荐(0) 编辑

2020年1月2日

摘要: Given a pair of positive integers, for example, 6 and 110, can this equation 6 = 110 be true? The answer is yes, if 6 is a decimal number and 110 is a 阅读全文
posted @ 2020-01-02 19:41 gnftau 阅读(218) 评论(0) 推荐(0) 编辑

2019年12月21日

摘要: Given a sequence of K integers { N​1​​, N​2​​, ..., N​K​​ }. A continuous subsequence is defined to be { N​i​​, N​i+1​​, ..., N​j​​ } where 1. The Max 阅读全文
posted @ 2019-12-21 20:58 gnftau 阅读(293) 评论(0) 推荐(0) 编辑

2019年11月7日

摘要: kmp算法的视频讲解: https://www.bilibili.com/video/av11866460?from=search&seid=5058972752612228463 https://www.bilibili.com/video/av16828557 kmp的应用题目: https:/ 阅读全文
posted @ 2019-11-07 20:17 gnftau 阅读(115) 评论(0) 推荐(0) 编辑

2019年10月11日

摘要: 链接:https://ac.nowcoder.com/acm/contest/1034/B来源:牛客网 题目描述 在一片广袤无垠的原野上,散落着N块磁石。 每个磁石的性质可以用一个五元组(x,y,m,p,r)描述,其中x,y表示其坐标,m是磁石的质量,p是磁力,r是吸引半径。 若磁石A与磁石B的距离 阅读全文
posted @ 2019-10-11 21:38 gnftau 阅读(535) 评论(0) 推荐(0) 编辑

2019年10月7日

摘要: 链接:https://ac.nowcoder.com/acm/contest/1034/A来源:牛客网 题目描述 在乡下的小路旁种着许多蒲公英,而我们的问题正是与这些蒲公英有关。 为了简化起见,我们把所有的蒲公英看成一个长度为 n 的序列a1,a2,…,ana_1,a_2,\dots,a_na1​, 阅读全文
posted @ 2019-10-07 23:52 gnftau 阅读(355) 评论(0) 推荐(0) 编辑

2019年9月22日

摘要: LIS O(n^2)算法: LIS O(nlogn)算法: LCS O(n^2)算法: LCS O(nlogn)算法: 最长公共子序列 的 nlogn 的算法本质是 将该问题转化成 最长增序列(LIS),因为 LIS 可以用nlogn实现,所以求LCS的时间复杂度降低为 nlogn。 假设有两个序列 阅读全文
posted @ 2019-09-22 23:17 gnftau 阅读(198) 评论(0) 推荐(0) 编辑

2019年9月18日

摘要: 链接:https://ac.nowcoder.com/acm/contest/1032/A来源:牛客网 题目描述 在完成了分配任务之后,西部314来到了楼兰古城的西部。 相传很久以前这片土地上(比楼兰古城还早)生活着两个部落,一个部落崇拜尖刀(‘V’),一个部落崇拜铁锹(‘∧’),他们分别用V和∧的 阅读全文
posted @ 2019-09-18 17:41 gnftau 阅读(378) 评论(0) 推荐(0) 编辑