---
# System prepended metadata

title: April 2 IDP Questions

---

# April 2 IDP Questions

## Easy - 1

**Reference:** https://practice.geeksforgeeks.org/problems/equilibrium-point-1587115620/1?page=2&category[]=Arrays&category[]=Strings&curated[]=1&curated[]=8&curated[]=7&sortBy=difficulty

**Question:** Given an array of numbers, find the index in which the sum of numbers before the index is equal to the sum of numbers after the index.


## Easy - 2

**Reference:** https://leetcode.com/problems/removing-minimum-and-maximum-from-array/description/

**Question:** Given an array of numbers, print the minimum number of deletions it would take to remove both the minimum and maximum element from the array.

You need to remove the elements only from beginning and ending.

**Example:**

Input: nums = [2,10,7,5,4,1,8,6], Output: 5

Minimum is 1 and Maximum is 10.

We can remove both the minimum and maximum by removing 2 elements from the front and 3 elements from the back.

This results in 2 + 3 = 5 deletions, which is the minimum number possible.

## Medium - 1

**Reference:** https://leetcode.com/problems/maximum-points-you-can-obtain-from-cards/description/

**Question:** Given an array of numbers, K. In one step, you can take one number from the beginning or end. You have to take exactly k numbers.

Score is the sum of the numbers that are taken. Print the maximum possible score.

**Example:**

Input: nums = [9,1,3,4,3,6,1], k = 3
Output: 16

Take 1 number (9) from beginning and 2 numbers from the end for maximum points 16.

## Medium - 2

**Reference:** https://leetcode.com/problems/find-all-people-with-secret/description/

**Question:** Given number of people(n) (Person 0 to Person N-1), array of meetings (meetings[i] = [xi, yi, timei]) indicates that person xi and person yi have a meeting at timei, K (first person) whom the secret is shared.

Initially person 0 shares the secret with K, For every meeting, if a person xi has the secret at timei, then they will share the secret with person yi, and vice versa. (Sorted by time)

Return a list of all the people that have the secret after all the meetings have taken place.

**Example:**

**Input:** n = 6, meetings = [[1,2,5],[2,3,8],[1,5,10]], firstPerson = 1
**Output:** [0,1,2,3,5]

At time 0, person 0 shares the secret with person 1.
At time 5, person 1 shares the secret with person 2.
At time 8, person 2 shares the secret with person 3.
At time 10, person 1 shares the secret with person 5.
Thus, people 0, 1, 2, 3, and 5 know the secret after all the meetings.


**Reduced the complexity by having only one meeting at a specific time**

## Hard

**Reference:** https://leetcode.com/problems/text-justification/

**Question:** Given an array of words, max width. Format the text such that each line has exactly maxWidth characters and is fully (left and right) justified.

Extra spaces between words should be distributed as evenly as possible. If the number of spaces are not evenly distributed, the spaces should be more in left.

For the last line of text, it should be left-justified, and no extra space is inserted between words.

**Example:**

**Input:** words = ["This", "is", "an", "example", "of", "text", "justification."], maxWidth = 16
**Output:**
[
   "This    is    an",
   "example  of text",
   "justification.  "
]






