Home

[leetcode] 994. Rotting Oranges _ Algorithm Problem Solve for python

1. Problem 994. Rotting Oranges You are given an m x n grid where each cell can have one of three values: 0 representing an empty cell, 1 representing a fresh orange, or 2 representing a rotten orange. Every minute, any fresh orange that is 4-directionally adjacent to a rotten orange becomes rotten. Return the minimum number of minu...

Read more

[leetcode] 1493. Longest Subarray of 1's After Deleting One Element _ Algorithm Problem Solve for python

1. Problem 1493. Longest Subarray of 1’s After Deleting One Element Given a binary array nums, you should delete one element from it. Return the size of the longest non-empty subarray containing only 1’s in the resulting array. Return 0 if there is no such subarray. Example 1: Input: nums = [1,1,0,1] Output: 3 Explanation: After deleting the...

Read more

[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