随笔分类 -  Leetcode

摘要:Given a string s, return the number of palindromic substrings in it. A string is a palindrome when it reads the same backward as forward. A substring 阅读全文
posted @ 2021-09-07 16:07 飞翔的菜鸟123 阅读(38) 评论(0) 推荐(0)
摘要:题目 class Solution { public: int countBinarySubstrings(string s) { int result = 0; int prev = 0; int current = 1; int n=s.size(); for(int i = 1 ; i < n 阅读全文
posted @ 2020-08-10 19:24 飞翔的菜鸟123 阅读(113) 评论(0) 推荐(0)
摘要:Description Problem 易错点 assuming both players play optimally. Means 你需要保存一个关于N的最佳数组,每轮归谁都会是最佳的 Then Prove N 为奇数的时候 Alice(先手)必败,N 为偶数的时候 Alice 必胜。 1.\( 阅读全文
posted @ 2020-07-24 12:46 飞翔的菜鸟123 阅读(160) 评论(0) 推荐(0)
摘要:Description Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. push(x) Push element x onto stack. pop() 阅读全文
posted @ 2020-05-12 23:38 飞翔的菜鸟123 阅读(146) 评论(0) 推荐(0)
摘要:Description "Problem" In a country popular for train travel, you have planned some train travelling one year in advance. The days of the year that you 阅读全文
posted @ 2020-05-06 22:44 飞翔的菜鸟123 阅读(132) 评论(0) 推荐(0)
摘要:Given a binary tree, determine if it is a valid binary search tree (BST). Assume a BST is defined as follows: The left subtree of a node contains only 阅读全文
posted @ 2020-05-06 18:07 飞翔的菜鸟123 阅读(131) 评论(0) 推荐(0)
摘要:Description Write an algorithm to determine if a number n is "happy". A happy number is a number defined by the following process: Starting with any p 阅读全文
posted @ 2020-04-30 12:24 飞翔的菜鸟123 阅读(167) 评论(0) 推荐(0)
摘要:二进制中1的个数 "题目链接" 每位遍历O(n) 只遍历1的个数O(m) 阅读全文
posted @ 2020-04-23 22:28 飞翔的菜鸟123 阅读(139) 评论(0) 推荐(0)
摘要:01二维数组的查找 cpp class Solution { public: void replaceSpace(char str,int length) { string s=""; for(int x=0;x原字符串修改 03从尾到头反转链表 不能改变链表结构 可以改变 04重建二叉树 12 P 阅读全文
posted @ 2020-04-14 23:24 飞翔的菜鸟123 阅读(190) 评论(0) 推荐(0)
摘要:第 175 场周赛 Description Implement the class TweetCounts that supports two methods: 1. recordTweet(string tweetName, int time) Stores the tweetName at th 阅读全文
posted @ 2020-02-09 20:31 飞翔的菜鸟123 阅读(160) 评论(0) 推荐(0)
摘要:1048 Longest String Chain Given a list of words, each word consists of English lowercase letters. Let's say word1 is a predecessor of word2 if and onl 阅读全文
posted @ 2019-12-15 19:56 飞翔的菜鸟123 阅读(181) 评论(0) 推荐(0)
摘要:优先队列的使用 阅读全文
posted @ 2019-12-14 13:53 飞翔的菜鸟123 阅读(213) 评论(0) 推荐(0)
摘要:PAT暂时没有题目练习拓扑排序,以下是Leetcode题目 There are a total of n courses you have to take, labeled from 0 to n 1.Some courses may have prerequisites, for example 阅读全文
posted @ 2019-12-13 17:28 飞翔的菜鸟123 阅读(244) 评论(1) 推荐(0)