• Tutorials
  • DSA
  • Data Science
  • Web Tech
  • Courses
August 21, 2024 |20 Views

PROBLEM OF THE DAY : 19/07/2024 | Count Smaller Elements

Description
Discussion

Welcome to the daily solving of our PROBLEM OF THE DAY with Saurabh Bansal We will discuss the entire problem step-by-step and work towards developing an optimized solution. This will not only help you brush up on your concepts of Arrays but also build up problem-solving skills.

Given an array arr containing non-negative integers. Count and return an array ans where ans[i] denotes the number of smaller elements on right side of arr[i].

Examples:

Input: arr[] = [12, 1, 2, 3, 0, 11, 4]
Output: [6, 1, 1, 1, 0, 1, 0]
Explanation: There are 6 smaller elements right after 12. There is 1 smaller element right after 1. And so on.

Give the problem a try before going through the video. All the best!!!
Problem Link: https://www.geeksforgeeks.org/problems/count-smaller-elements2214/1