uz
Feedback

Firibgarlarga uchmang! Telemetrio bunday kanallarni topadi va belgilaydi 👉 Belgini ko‘rmoqchi bo‘lsangiz, obuna bo‘ling

IBM HACKERRANK CODING SOLUTIONS

IBM HACKERRANK CODING SOLUTIONS

Kanalga Telegram’da o‘tish

We provide help for all Exams... Anyone can contact me @AK_Coder for Exam clearance and interviews Trusted ✅

Ko'proq ko'rsatish
Mamlakat belgilanmaganToif belgilanmagan
4 420
Obunachilar
Ma'lumot yo'q24 soatlar
Ma'lumot yo'q7 kun
Ma'lumot yo'q30 kun
Postlar arxiv
Njan ayachu

2code code click save and next

/noforwards

Contact him @bulliea

i got interview mail today and shedule is tomorrow

import java.util.*; import java.math.*; class GFG { // Function to maximise the sum of selected numbers //by deleting occurrences of Ai-1 and Ai+1 public static int getMaximumSum (int arr[]) { // Number of elements in the array int n = arr.length; // Largest element in the array int max = -1; for(int i = 0; i < n; i++) { max = Math.max(max, arr[i]); } // An array to count the occurrence of each element int []freq = new int[max + 1]; for(int i = 0; i < n; i++) { freq[arr[i]]++; } // ans to store the result int ans = 0, i=max; // Using the above mentioned approach while(i>0){ // if occurence is greater than 0 if(freq[i] > 0){ // add it to ans ans += i; // decrease i-1th element by 1 freq[i-1]--; // decrease ith element by 1 freq[i]--; }else{ // decrease i i--; } } return ans; } public static void main(String[] args) { int []a = {1, 2, 3}; System.out.println(getMaximumSum(a)); } }

Both test case pass

Updated check 💯

Shiva, your message contains words listed on blacklist.

This is how we help in premium group🤩 💯✨ 🔴This was previous IRA that was on 2nd may 🔴Without single error in code..given💯💯 Just 100% results given for 2nd May 🚨if anyone need help for tomorrow IRA ping me @bulliea to join 9nd May premium group