Meta | E4 Onsite
Anonymous User
4528

1st Coding round

Question1 :
https://leetcode.com/problems/binary-tree-vertical-order-traversal/

Question 2:
https://leetcode.com/problems/max-consecutive-ones-iii/

2nd Coding round
Question 1 :

Given an array that contains both integers and nested arrays,
calculate and return the depth sum.

For example:

Input: [8, 4, [5, [9], 3], 6]

Output: 8 + 4 + 2 * (5 + 3 * (9) + 3) + 6 ==> 88

https://leetcode.com/problems/nested-list-weight-sum/

Question 2
/*
Given a game board, represented as 2D array of zeroes and ones. Zero stands for passible positions and one stands for impassable positions. Design an algorithm to find a shortest path from top left corner to bottom right corner. For example, given a board of the following, a possible path is denoted by + on the second board.

0 0 0 0 0 0 0
0 0 1 0 0 1 0
0 0 1 0 1 1 0
0 0 1 0 1 0 1
1 1 1 0 0 0 0

Possible path:

        • 0 0 0
          0 0 1 + 0 1 0
          0 0 1 + 1 1 0
          0 0 1 + 1 0 1
          1 1 1 + + + +

For this question, let's return (0, 0) -> (0, 1) -> (0, 2) -> (0, 3) -> (1, 3) -> (2, 3) -> (3, 3) -> (4, 3) -> (4, 4) -> (4, 5) -> (4, 6)

Comments (9)