Please subscribe to the official Codeforces channel in Telegram via the link https://t.me/codeforces_official. ×

Super Hard Uber OA Problem | Count the number of good permutations | July
Difference between en1 and en2, changed 15 character(s)
How to solve this problem asked in Uber OA :- ↵

You can assume N walls with distinct heights. ↵

You are given an array A. A[i] denotes how many walls can be viewed if you stand after the i'th wall ↵

Example array of walls :- [5 4 2 3 1] ↵

A[1] = 1 ↵
A[2] = 2↵
A[3] = 3 ↵
A[4] = 3 (You can view 5 , 4 , 3 -> if you stand after 3 and observe.) ↵
A[5] = 4 ↵

Given an array A ; find the count of permutations possible of size "N" ("N" walls with distinct heights from 1 to N) ↵

Input :- A : [1 2 3 1 2] ↵

Output :- 4 ↵

[4 3 2 5 1]↵

[4 3 1 5 2]↵

[4 2 1 5 3]↵

[3 2 1 5 4] ↵

Tried many ways couldn't find any that works. ↵




History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English LovesProgramming 2024-07-19 21:14:20 15
en1 English LovesProgramming 2024-07-19 21:13:35 720 Initial revision (published)