₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,325,782 members, 8,423,690 topics. Date: Wednesday, 10 June 2026 at 07:03 AM

Toggle theme

Namikaze's Posts

Nairaland ForumNamikaze's ProfileNamikaze's Posts

1 2 3 4 5 6 7 (of 7 pages)

ProgrammingRe: A "Senior" Software Developer Could Not Solve This Coding Challenge, Can You? by namikaze(op): 8:52am On May 29, 2022
GREATIGBOMAN:
Simple stuffz


Remember my days at leetcode.


I just add identical values in the arrays to a new array

Later check the length of each array then form a new array depending on which is longer
That's an interesting way to look at it, looking forward to your solution.
ProgrammingRe: A "Senior" Software Developer Could Not Solve This Coding Challenge, Can You? by namikaze(op):
My solution:
def sort_by_frequency(arr):
fmap = {}
for num in arr:
fmap[num] = fmap.get(num, 0) + 1
arr = [ (v,k) for k,v in fmap.items() ]
arr.sort(reverse=True)
return [ b for a,b in arr ]

Let's see yours.
ProgrammingA "Senior" Software Developer Could Not Solve This Coding Challenge, Can You? by namikaze(op): 8:09am On May 29, 2022
Apparently a senior software developer could not solve this coding interview problem, can you?

Given an array of numbers, list them in the order of most repeated. I.e:
[1,2,6,2,3,7,7,5,7,6,2,7] => [7,2,6,5,3,1]

source: ``https://www./programmer.nullposting/permalink/1456356328162617/?app=fbl``

1 2 3 4 5 6 7 (of 7 pages)