Zupee software engineer interviews cover algorithms, data structures, system design, and coding problems drawn from real interview rounds.
Question A trading analytics platform stores executed trade prices for a stock during a trading window in a sorted list. A price is considered...
Input: List1s (land) and 0s (water). Write a function to count the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically.def num_islands(grid: List[List[str]]) -> int: grid = [['1','1','0','0','0'],
['1','1','0','0','0'],
['0','0','1','0','0'],
['0','0','0','1','1']] 3 grid = [['1','1','1','1','0'],
['0','1','0','0','0'],
['1','1','0','1','1']] 1 1 <= grid.length <= 300 1 <= grid[i].length <= 300 grid[i][j] is either 0 or 1. '1's (land) and '0's (water), implement a function to count the number of distinct islands. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. Two islands are considered different if they have different shapes.def numIslands(grid: List[List[str]]) -> int: [['1','1','0','0','0'], ['1','0','0','1','0'], ['0','0','0','0'], ['0','0','1','1','1']]3 [['1','0','0','1'], ['0','0','0','0'], ['1','0','1','1']]3 100 x 100.'1' or '0'. 1 represents land and 0 represents water, count the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. You may assume all four edges of the grid are surrounded by water. def num_islands(grid: List[List[str]]) -> int: [['1','1','1','1','0'], ['1','1','0','1','0'], ['0','0','0','0','0'], ['0','1','1','0','1']] 3 [['1','1','0','0','0'], ['0','1','0','0','1'], ['0','0','0','1','1']] 4 1 <= grid.length, grid[i].length <= 300 grid[i] are either '0' or '1'. 2D grid representing a map where 1 represents land and 0 represents water, write a function that returns the number of islands (connected components of 1's) in the grid. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically.def numIslands(grid: List[List[str]]) -> int: grid = [["1","1","0","0","0"], ["1","1","0","0","0"], ["0","0","1","0","0"], ["0","0","0","1","1"]] 3 1s.grid = [["1","1","1","1","0"], ["1","0","0","1","0"], ["1","1","0","0","0"]] 1 1 <= grid.length <= 300 1 <= grid[0].length <= 300 "0" or "1". coins, representing different denominations of coins available, and an integer amount representing the total amount of money to make change for. Your task is to compute the number of different ways to make change for that amount using the available coins. Return the number of combinations that make up that amount. The same combination of coins can be used in different orders but should only be counted once (e.g., [1, 2] is the same as [2, 1]). def change(amount: int, coins: List[int]) -> int:amount = 5, coins = [1, 2, 5] 4 amount = 3, coins = [2] 0 0 <= amount <= 5000 1 <= coins.length <= 300 1 <= coins[i] <= 5000 1s (land) and 0s (water), write a function that returns the number of islands (connected 1s). def numIslands(grid: List[List[str]]) -> int: grid = [['1','1','0','0','0'], ['1','1','0','0','0'], ['0','0','1','0','0'], ['0','0','0','1','1']] 3 grid = [['1','1','1','1','0'], ['0','1','0','0','0'], ['1','1','0','1','1']] 2 1 <= grid.length, grid[i].length <= 300 grid[i][j] is '0' or '1'. Sign up for free to access walkthroughs, AI-generated questions, and more.
Get Started Free