Home

[leetcode] 394. Decode String _ Algorithm Problem Solve for python

1. Problem 394. Decode String Given an encoded string, return its decoded string. The encoding rule is: k[encoded_string], where the encoded_string inside the square brackets is being repeated exactly k times. Note that k is guaranteed to be a positive integer. You may assume that the input string is always valid; there are no extra white sp...

Read more

[leetcode] 1466. Reorder Routes to Make All Paths Lead to the City Zero _ Algorithm Problem Solve for python

1. Problem 1466. Reorder Routes to Make All Paths Lead to the City Zero There are n cities numbered from 0 to n - 1 and n - 1 roads such that there is only one way to travel between two different cities (this network form a tree). Last year, The ministry of transport decided to orient the roads in one direction because they are too narrow. Ro...

Read more

[leetcode] 62. Unique Paths _ Algorithm Problem Solve for python

1. Problem 62. Unique Paths There is a robot on an m x n grid. The robot is initially located at the top-left corner (i.e., grid[0][0]). The robot tries to move to the bottom-right corner (i.e., grid[m - 1][n - 1]). The robot can only move either down or right at any point in time. Given the two integers m and n, return the number of possible...

Read more

[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