Rushil Sharma’s Post

View profile for Rushil Sharma, graphic

CS Freshman | Full Stack Developer | MERN Stack | JUIT

🚀 𝗗𝗮𝘆 𝟮𝟱: Just solved LeetCode Problem 747: 𝗟𝗮𝗿𝗴𝗲𝘀𝘁 𝗡𝘂𝗺𝗯𝗲𝗿 𝗮𝘁 𝗟𝗲𝗮𝘀𝘁 𝗧𝘄𝗶𝗰𝗲 𝗼𝗳 𝗢𝘁𝗵𝗲𝗿𝘀, a fun problem that combines array traversal and conditional checks! 𝗣𝗿𝗼𝗯𝗹𝗲𝗺: Given an integer array 𝗻𝘂𝗺𝘀 where the largest integer is at least twice as much as every other number in the array. Determine whether this condition holds true. If it does, return the index of the largest number. Otherwise, return -𝟭. I looped through the array to identify the index of the largest number. Using a second loop, I compared the largest number with each element to ensure it was at least twice as large as all others. If any element violated this condition, I returned -1. If the checks passed, I returned the index of the dominant number. 📍 Feeling motivated to keep tackling more such problems! #LeetCode #CodingJourney #DataStructures #Algorithms #Cpp #DSA #LargestNumber #TwiceOfOthers #Programming #DailyLearning #Developer #ProblemSolving

  • No alternative text description for this image

To view or add a comment, sign in

Explore topics