Message on Whatsapp 8879355057 for DSA(OA + Interview) + Fullstack Dev Training + 1-1 Personalized Mentoring to get 10+LPA Job
0 like 0 dislike
1,666 views

All past online assesments of Google can be found using the tag "google_oa" in the search bar.

Here is the link :  https://www.desiqna.in/tag/google_oa

in Online Assessments by Expert (32,020 points) | 1,666 views

1 Answer

0 like 0 dislike

Google Online Assessment (OA) - Minimum Number of Decreasing Subsequence Partitions

Given an integer array, split it into strictly decreasing subarrays. Return the minimum number of decreasing subarrays you can get from splitting the array.

Examples

Example 1:

Input:

[5, 2, 4, 3, 1, 7]

Output: 3

Explanation:

The array can be split into [5, 2, 1][4, 3][7] to get 3 decreasing subarrays. Or it can be split into [5, 4, 3][2, 1][7] to also get 3 decreasing subarrays.

The partition of [5, 4, 3, 2, 1][7] is not valid because [5, 4, 3, 2, 1] is not a subarray of the original array.

Example 2:

Input:

[2, 9, 13, 14, 4, 8, 7, 6, 10]

Output: 4

Explanation:

[2], [9, 4], [13, 10], [14, 8, 7, 6]

Example 3:

Input:

[6, 6, 6]

Output: 3

Explanation:

[6], [6], [6]

by Expert (32,020 points)