Category: Coderbyte
-
Code Interview – Eight Queens – Code challenge – JavaScript Solution Source Code
CoderbyteEight Queens Have the function EightQueens(strArr) read strArr which will be an array consisting of the locations of eight Queens on a standard 8×8 chess board with no other pieces on the board. The structure of strArr will be the following: [“(x,y)”, “(x,y)”, …] where (x,y) represents the position of the current queen on the chessboard (x and y will both…
-
Code Interview – Letter Changes – Code challenge – JavaScript Solution Source Code
CoderbyteLetter Changes Have the function LetterChanges(str) take the str parameter being passed and modify it using the following algorithm. Replace every letter in the string with the letter following it in the alphabet (ie. c becomes d, z becomes a). Then capitalize every vowel in this new string (a, e, i, o, u) and finally return this modified string.
-
Code Interview – Seating Students – Code challenge – JavaScript Solution Source Code
CoderbyteSeating Students Have the function SeatingStudents(arr) read the array of integers stored in arr which will be in the following format: [K, r1, r2, r3, …] where K represents the number of desks in a classroom, and the rest of the integers in the array will be in sorted order and will represent the desks that are already occupied.…
-
Code Interview – Coderbyte – Counting Minutes – Code challenge – JavaScript Solution Source Code
Coderbyte Counting Minutes Have the function CountingMinutes(str) take the str parameter being passed which will be two times (each properly formatted with a colon and am or pm) separated by a hyphen and return the total number of minutes between the two times. The time will be in a 12 hour clock format. For example:…
-
Code Interview – Coderbyte – Simple Mode – Code challenge – JavaScript Solution Source Code
Coderbyte Simple Mode Have the function SimpleMode(arr) take the array of numbers stored in arr and return the number that appears most frequently (the mode). For example: if arr contains [10, 4, 5, 2, 4] the output should be 4. If there is more than one mode return the one that appeared in the array…
-
Code Interview – Coderbyte – Swap II – Code challenge – JavaScript Solution Source Code
Coderbyte Swap II Have the function SwapII(str) take the str parameter and swap the case of each character. Then, if a letter is between two numbers (without separation), switch the places of the two numbers. For example: if str is “6Hello4 -8World, 7 yes3” the output should be 4hELLO6 -8wORLD, 7 YES3.
-
Code Interview – Coderbyte – Number Search – Code challenge – JavaScript Solution Source Code
Coderbyte Number Search Have the function NumberSearch(str) take the str parameter, search for all the numbers in the string, add them together, then return that final number divided by the total amount of letters in the string. For example: if str is “Hello6 9World 2, Nic8e D7ay!” the output should be 2. First if you…
-
Code Interview – Coderbyte – Array Addition – Code challenge – JavaScript Solution Source Code
Coderbyte Array Addition Have the function ArrayAddition(arr) take the array of numbers stored in arr and return the string true if any combination of numbers in the array (excluding the largest number) can be added up to equal the largest number in the array, otherwise return the string false. For example: if arr contains [4,…
-
Code Interview – Coderbyte – String Scramble – Code challenge – JavaScript Solution Source Code
Coderbyte String Scramble Have the function StringScramble(str1,str2) take both parameters being passed and return the string true if a portion of str1 characters can be rearranged to match str2, otherwise return the string false. For example: if str1 is “rkqodlw” and str2 is “world” the output should return true. Punctuation and symbols will not be…
-
Code Interview – Coderbyte – Run Length – Code challenge – JavaScript Solution Source Code
Coderbyte Run Length Have the function RunLength(str) take the str parameter being passed and return a compressed version of the string using the Run-length encoding algorithm. This algorithm works by taking the occurrence of each repeating character and outputting that number along with a single character of the repeating sequence. For example: “wwwggopp” would return…