随笔分类 -  algorithm

摘要:最长回文,谁能解释一下下面这个解法? Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example 1: Inpu 阅读全文
posted @ 2018-06-29 14:23 VickyFengYu 阅读(109) 评论(0) 推荐(0)
摘要:Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining. 阅读全文
posted @ 2018-06-26 12:11 VickyFengYu 阅读(107) 评论(0) 推荐(0)
摘要:Question 1: How to find middle element of linked list in one pass? Question 1: How to find middle element of linked list in one pass? One of the most 阅读全文
posted @ 2018-06-26 10:33 VickyFengYu
摘要:What are Divide and Conquer algorithms? Describe how they work. Can you give any common examples of the types of problems where this approach might be 阅读全文
posted @ 2018-06-26 10:28 VickyFengYu
摘要:Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. You may assume that the 阅读全文
posted @ 2018-06-22 10:10 VickyFengYu 阅读(90) 评论(0) 推荐(0)