Publicis Sapient | Placement Coding Round | Sub-Palindrome Unique Substrings | Recent Online Assessment 2026 | Triplets Within Range
Publicis-Sapient · Question · Posted Mar 2026
Question 1: Triplets Within Range Problem Statement: You are given an array of integers and a number d. Select a group of three elements where the difference between the largest and smallest values in the group is at most d. Return the total number of such groups, modulo (10^9 + 7). Example 1: Input: arr = [-3, -2, -1, 0], d = 2 Output: 2 Explanation: All Valid Triplets: Elements: [-3, -2, -1] Maximum Difference: (-1) - (-3) = 2 ...
The full answer & interview discussion are available to premium members.
Log in Create a free account