matyokubov | personal blog
Notes about IT from @firdavsmatyokubov also https://github.com/matyokubov
نمایش بیشتر- مشترکین
- پوشش پست
- ER - نسبت تعامل
در حال بارگیری داده...
در حال بارگیری داده...
Can you solve this real interview question? Same Tree - Given the roots of two binary trees p and q, write a function to check if they are the same or not. Two binary trees are considered the same if they are structurally identical, and the nodes have the same value. Example 1: [
https://assets.leetcode.com/uploads/2020/12/20/ex1.jpg]Input: p = [1,2,3], q = [1,2,3] Output: true Example 2: [
https://assets.leetcode.com/uploads/2020/12/20/ex2.jpg]Input: p = [1,2], q = [1,null,2] Output: false Example 3: [
https://assets.leetcode.com/uploads/2020/12/20/ex3.jpg]Input: p = [1,2,1], q = [1,1,2] Output: false Constraints: * The number of nodes in both trees is in the range [0, 100]. * -104 <= Node.val <= 104
Can you solve this real interview question? Climbing Stairs - You are climbing a staircase. It takes n steps to reach the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top? Example 1: Input: n = 2 Output: 2 Explanation: There are two ways to climb to the top. 1. 1 step + 1 step 2. 2 steps Example 2: Input: n = 3 Output: 3 Explanation: There are three ways to climb to the top. 1. 1 step + 1 step + 1 step 2. 1 step + 2 steps 3. 2 steps + 1 step Constraints: * 1 <= n <= 45