随笔分类 - 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
阅读全文
摘要:题目 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
阅读全文
摘要:Description Problem 易错点 assuming both players play optimally. Means 你需要保存一个关于N的最佳数组,每轮归谁都会是最佳的 Then Prove N 为奇数的时候 Alice(先手)必败,N 为偶数的时候 Alice 必胜。 1.\(
阅读全文
摘要: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()
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要:二进制中1的个数 "题目链接" 每位遍历O(n) 只遍历1的个数O(m)
阅读全文
摘要:01二维数组的查找 cpp class Solution { public: void replaceSpace(char str,int length) { string s=""; for(int x=0;x原字符串修改 03从尾到头反转链表 不能改变链表结构 可以改变 04重建二叉树 12 P
阅读全文
摘要:第 175 场周赛 Description Implement the class TweetCounts that supports two methods: 1. recordTweet(string tweetName, int time) Stores the tweetName at th
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文

浙公网安备 33010602011771号