6 kyu

Ideal electron distribution

787 of 1,398SandQueen

Description:

You are a khmmadkhm scientist and you decided to play with electron distribution among atom's shells. You know that basic idea of electron distribution is that electrons should fill a shell until it's holding the maximum number of electrons.


Rules:

  • Maximum number of electrons in a shell is distributed with a rule of 2n^2 (n being position of a shell).
  • For example, maximum number of electrons in 3rd shell is 2*3^2 = 18.
  • Electrons should fill the lowest level shell first.
  • If the electrons have completely filled the lowest level shell, the other unoccupied electrons will fill the higher level shell and so on.

Ex.:    atomicNumber(1); should return [1]
        atomicNumber(10); should return [2, 8]
        atomicNumber(11); should return [2, 8, 1]
        atomicNumber(47); should return [2, 8, 18, 19]
Arrays
Lists
Algorithms

More By Author:

Check out these other kata created by SandQueen

Stats:

CreatedMay 13, 2017
PublishedMay 13, 2017
Warriors Trained2035
Total Skips29
Total Code Submissions3405
Total Times Completed1398
JavaScript Completions541
Python Completions787
Ruby Completions85
Crystal Completions10
Haskell Completions45
COBOL Completions7
Total Stars35
% of votes with a positive feedback rating94% of 269
Total "Very Satisfied" Votes239
Total "Somewhat Satisfied" Votes27
Total "Not Satisfied" Votes3
Total Rank Assessments10
Average Assessed Rank
6 kyu
Highest Assessed Rank
6 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • SandQueen Avatar
  • Unnamed Avatar
  • GiacomoSorbi Avatar
  • stellartux Avatar
  • akar-0 Avatar
  • Just4FunCoder Avatar
  • XoRMiAS Avatar
  • saudiGuy Avatar
Ad