Home

[leetcode] 547. Number of Provinces _ Algorithm Problem Solve for python

1. Problem 547. Number of Provinces There are n cities. Some of them are connected, while some are not. If city a is connected directly with city b, and city b is connected directly with city c, then city a is connected indirectly with city c. A province is a group of directly or indirectly connected cities and no other cities outside of the ...

Read more

[leetcode] 739. Daily Temperatures _ Algorithm Problem Solve for python

1. Problem 739. Daily Temperatures Given an array of integers temperatures represents the daily temperatures, return an array answer such that answer[i] is the number of days you have to wait after the ith day to get a warmer temperature. If there is no future day for which this is possible, keep answer[i] == 0 instead. Example 1: Input: temp...

Read more

[leetcode] 841. Keys and Rooms _ Algorithm Problem Solve for python

1. Problem 841. Keys and Rooms There are n rooms labeled from 0 to n - 1 and all the rooms are locked except for room 0. Your goal is to visit all the rooms. However, you cannot enter a locked room without having its key. When you visit a room, you may find a set of distinct keys in it. Each key has a number on it, denoting which room it unlo...

Read more

[leetcode] 933. Number of Recent Calls _ Algorithm Problem Solve for python

1. Problem 933. Number of Recent Calls You have a RecentCounter class which counts the number of recent requests within a certain time frame. Implement the RecentCounter class: RecentCounter() Initializes the counter with zero recent requests. int ping(int t) Adds a new request at time t, where t represents some time in milliseconds, an...

Read more

[leetcode] 1456. Maximum Number of Vowels in a Substring of Given Length _ Algorithm Problem Solve for python

1. Problem 1456. Maximum Number of Vowels in a Substring of Given Length Given a string s and an integer k, return the maximum number of vowel letters in any substring of s with length k. Vowel letters in English are ‘a’, ‘e’, ‘i’, ‘o’, and ‘u’. Example 1: Input: s = "abciiidef", k = 3 Output: 3 Explanation: The substring "iii" contains 3 vo...

Read more