SAP Labs | OA | Coding Round | 17 dec 2022
Question · Posted Apr 2026
Problem Statement: Quadruples Search The Objective: You are given a permutation arr of size n (distinct integers from 1 to n). Your task is to find the total number of quadruples of indices (i,j,k,l) that satisfy the following conditions: Index Ordering: 1≤i<j<k<l≤n Value Ordering: arr[i]<arr[k]<arr[j]<arr[l] Notes: 1-based indexing is followed. A permutation of length n consists of all integers from 1 to n appearing exactly once. Example Walkthrough Input: n=5 arr=[1,3,2,4,5] Analysis of a Quadruple {1,2,3,4}: Indices: i=1,j=2,k=3,l=4 Check condition ...
The full answer & interview discussion are available to premium members.
Log in Create a free account