Login

Striver SDE Sheet Problems

Problem title

Difficulty

Avg time to solve

Divide Two Integers

Easy

10 mins

Flatten Binary Tree to Linked List

Moderate

25 mins

Find Duplicate in Array

Easy

15 mins

BST Iterator

Moderate

20 mins

Maximum Product Subarray

Moderate

25 mins

Next Smaller Element

Moderate

25 mins

Delete Node In A Linked List

Easy

15 mins

Find MSB In O(1)

Easy

10 mins

Clone Graph

Moderate

25 mins

Remove Duplicates from Sorted Array

Easy

15 mins

Problem

Submissions

6

Avg. time to solve

10 min

Success Rate

90%

Problem Statement

```
In cases where the dividend is not perfectly divisible by the divisor, you are required to return the floored value of the quotient.
```

```
If the answer is ‘9.333’ then return ‘9’ or if the answer is ‘-8.123’ then return ‘-8’.
```

```
The first line of input contains an integer ‘T’ denoting the number of test cases.
The next ‘T’ lines represent the ‘T’ test cases.
The first line of every test case contains two space-separated integers ‘dividend’ and ‘divisor’.
```

```
For each test case, return the floor value of the quotient.
Output for each test case will be printed in a separate line.
```

```
You do not need to print anything, it has already been taken care of. Just implement the given function.
```

```
1 <= T <= 10^5
-10^9 <= dividend, divisor <= 10^9
divisor != 0
Time limit: 1 second
```

```
2
10 3
-9 2
```

```
3
-4
```

```
In test Case 1:
Given ‘dividend = 10’ and ‘divisor = 3’
So the division is ‘10/3 = 3.3333……’.
Return only integer part ‘3’
In test Case 2:
Given ‘dividend = -9’ and ‘divisor = 2’
So the division is ‘-9/2 = -4.5’.
Return only integer part ‘-4’
```

```
3
7 -3
-9 -1
-1 2
```

```
-2
9
0
```

Console

Sample Test Case

Custom Test Case

Download Test Cases

Test Case 1

Test Case 2

Test Case 3

Saving Code...

Full Screen Mode

Change Language

Change Theme

Solution submission not allowed

Save Code

Reset Code