6 kyu

Mid-Endian numbers

51 of 195GiacomoSorbi

Description:

While most devs know about big/little-endianness, only a selected few know the secret of real hard core coolness with mid-endians.

Your task is to take a number and return it in its mid-endian format, putting the most significant couple of bytes in the middle and all the others around it, alternating left and right.

For example, consider the number 9999999, whose hexadecimal representation would be 98967F in big endian (the classic you get converting); it becomes 7F9698 in little-endian and 96987F in mid-endian.

Write a function to do that given a positive integer (in base 10) and remembering that you need to pad with 0s when you get a single hex digit!

Algorithms

Stats:

CreatedJul 5, 2018
PublishedJul 6, 2018
Warriors Trained658
Total Skips45
Total Code Submissions875
Total Times Completed195
JavaScript Completions51
Python Completions93
Ruby Completions20
Crystal Completions4
C++ Completions37
C# Completions22
Total Stars14
% of votes with a positive feedback rating91% of 67
Total "Very Satisfied" Votes58
Total "Somewhat Satisfied" Votes6
Total "Not Satisfied" Votes3
Total Rank Assessments7
Average Assessed Rank
6 kyu
Highest Assessed Rank
6 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • GiacomoSorbi Avatar
  • lechevalier Avatar
  • kazk Avatar
  • KataSideKick Avatar
  • hobovsky Avatar
  • Just4FunCoder Avatar
  • saudiGuy Avatar
Ad