Today’s question from Daily leetcode challenge — February edition. This question has been asked in Google interviews. Let us look into the problem statement.

**946****. Validate Stack Sequences**

Given two sequences `pushed`

and `popped`

**with distinct values**, return `true`

if and only if this could have been the result of a sequence of push and pop operations on an initially empty stack.

**Example 1:**

**Input: **pushed = [1,2,3,4,5], popped = [4,5,3,2,1]

**Output: **true

**Explanation: **We might do the following sequence:

push(1), push(2), push(3), push(4), pop() -> 4,

push(5), pop() -> 5, pop() -> 3, pop() -> 2, pop() -> 1

**…**

Today’s question from Daily leetcode challenge — February edition. Let us look into the problem statement.

**581****. Shortest Unsorted Continuous Subarray**

Given an integer array `nums`

, you need to find one **continuous subarray** that if you only sort this subarray in ascending order, then the whole array will be sorted in ascending order.

Return *the shortest such subarray and output its length*.

**Example 1:**

**Input:** nums = [2,6,4,8,10,9,15]

**Output:** 5

**Explanation:** You need to sort [6, 4, 8, 10, 9] in ascending order to make the whole array sorted in ascending order.

**Example 2:**

**Input:** nums = [1,2,3,4]

**Output:** 0

**…**

Today’s question is from Leetcode’s daily coding challenge February edition. Let us look into the problem statement.

**991****. Broken Calculator**

On a broken calculator that has a number showing on its display, we can perform two operations:

**Double**: Multiply the number on the display by 2, or;**Decrement**: Subtract 1 from the number on the display.

Initially, the calculator is displaying the number `X`

.

Return the minimum number of operations needed to display the number `Y`

.

**Example 1:**

**Input: **X = 2, Y = 3

**Output: **2

**Explanation: **Use double operation and then decrement operation {2 -> 4 -> 3}.

**…**

Today’s question is a SQL question. Let us look into the problem statement.

**177****. Nth Highest Salary**

Write a SQL query to get the *n*th highest salary from the `Employee`

table.

`+----+--------+`

| Id | Salary |

+----+--------+

| 1 | 100 |

| 2 | 200 |

| 3 | 300 |

+----+--------+

For example, given the above Employee table, the *n*th highest salary where *n* = 2 is `200`

. If there is no *n*th highest salary, then the query should return `null`

.

`+------------------------+`

| getNthHighestSalary(2) |

+------------------------+

| 200 |

+------------------------+

A few days back, we found the…

Today’s question is a medium-tagged question on leetcode. The question is taken from the daily coding challenge February edition. Let us look into the problem statement.

**277****. Find the Celebrity**

Suppose you are at a party with `n`

people (labeled from `0`

to `n - 1`

), and among them, there may exist one celebrity. The definition of a celebrity is that all the other `n - 1`

people know him/her, but he/she does not know any of them.

Now you want to find out who the celebrity is or verify that there is not one. The only thing you are…

Today’s question is a Leetcode medium-tagged question. Let us look into the problem statement.

**48****. Rotate Image**

You are given an *n* x *n* 2D `matrix`

representing an image, rotate the image by 90 degrees (clockwise).

You have to rotate the image **in-place**, which means you have to modify the input 2D matrix directly. **DO NOT** allocate another 2D matrix and do the rotation.

**Example 1:**

Today’s question is based on SQL. A very easy question. Let us look into the problem statement.

**175****. Combine Two Tables**

Table: `Person`

`+-------------+---------+`

| Column Name | Type |

+-------------+---------+

| PersonId | int |

| FirstName | varchar |

| LastName | varchar |

+-------------+---------+

PersonId is the primary key column for this table.

Table: `Address`

`+-------------+---------+`

| Column Name | Type |

+-------------+---------+

| AddressId | int |

| PersonId | int |

| City | varchar |

| State | varchar |

+-------------+---------+

AddressId is the primary key column for this table.

Write a SQL query…

Today’s question is an easy tagged question from Leetcode. Let us look into the problem statement.

Count the number of prime numbers less than a non-negative number, `n`

.

**Example 1:**

**Input:** n = 10

**Output:** 4

**Explanation:** There are 4 prime numbers less than 10, they are 2, 3, 5, 7.

**Example 2:**

**Input:** n = 0

**Output:** 0

**Example 3:**

**Input:** n = 1

**Output:** 0

**Constraints:**

`0 <= n <= 5 * 106`

One of the easiest ways to solve this problem is by checking if each number that is lesser than n is prime or not.

How…

Today’s question is from Leetcode’s daily coding challenge February edition. It is a medium-tagged question on Leetcode. Let us look into the problem statement.

**582****. Kill Process**

Given **n** processes, each process has a unique **PID (process id)** and its **PPID (parent process id)**.

Each process only has one parent process, but may have one or more children processes. This is just like a tree structure. Only one process has PPID that is 0, which means this process has no parent process. All the PIDs will be distinct positive integers.

We use two lists of integers to represent a list…

Today’s question is from leetcode’s daily coding challenge. This question is frequently asked in Facebook interviews. Let us look into the problem statement.

**785****. Is Graph Bipartite?**

There is an **undirected** graph with `n`

nodes, where each node is numbered between `0`

and `n - 1`

. You are given a 2D array `graph`

, where `graph[u]`

is an array of nodes that node `u`

is adjacent to. More formally, for each `v`

in `graph[u]`

, there is an undirected edge between node `u`

and node `v`

. The graph has the following properties:

- There are no self-edges (
`graph[u]`

does not contain`u`

). - There…

Software Engineer. Find me @ www.linkedin.com/in/annamariya-jt