Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,205,837 members, 7,993,910 topics. Date: Monday, 04 November 2024 at 09:33 PM

Namikaze's Posts

Nairaland Forum / Namikaze's Profile / Namikaze's Posts

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

Programming / Re: A "Senior" Software Developer Could Not Solve This Coding Challenge, Can You? by namikaze: 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.

1 Like

Programming / Re: A "Senior" Software Developer Could Not Solve This Coding Challenge, Can You? by namikaze: 8:13am On May 29, 2022
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.

3 Likes 1 Share

Programming / A "Senior" Software Developer Could Not Solve This Coding Challenge, Can You? by namikaze: 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 Like

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

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 4
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.