Created
May 2, 2023 07:09
-
-
Save far1dghaderi/1ed2c8f8db42643871a1e4895c0e9d30 to your computer and use it in GitHub Desktop.
Interview questions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//#region Capitalize | |
// Write a function that accepts a string. The function should | |
// capitalize the first letter of each word in the string then | |
// return the capitalized string. | |
//i.e-1: capitalize('a short sentence') --> 'A Short Sentence' | |
//i.e-2: capitalize('a lazy fox') --> 'A Lazy Fox' | |
//i.e-3: capitalize('look, it is working!') --> 'Look, It Is Working!' | |
function capitalize(str) { | |
//TODO | |
} | |
//Hello There | |
// console.log(capitalize('Hey, how you doin?')); | |
//You Got This. | |
// console.log(capitalize('you got this.')); | |
//Capitalize Me Please. | |
// console.log(capitalize('capitalize me please.')); | |
//#endregion |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//#region Most frequent character | |
//Write a function which receives a string as input and returns the most frequent character in it with the number frequency | |
//of each character | |
//NOTES: | |
//it must be case insensitive | |
//white-spaces must be ignored | |
//i.e-1: in "javascript", the most frequent character is 'a=>' | |
//i.e-2: in "football", the most frequent characters are is 'o=>2 and l=>2' | |
//i.e-3: in "python", we don't have a most frequent character | |
function mostFrequentCharacters(str) { | |
//TODO | |
} | |
//a=>5 | |
// console.log(mostFrequentCharacters(mostFrequentCharacter('guadalajara'))); | |
//b=>2, a=>2, l=>2 | |
// console.log(mostFrequentCharacters(mostFrequentCharacter('basketball'))); | |
//c=>3 | |
// console.log(mostFrequentCharacters(mostFrequentCharacter('CzecH republiC'))); | |
//nothing | |
// console.log(mostFrequentCharacters(mostFrequentCharacter('mouse'))); | |
//#endregion |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//#region Palindrome number | |
//Write a function which receives an integer as input, and check whether it's a palindrome number or not | |
//NOTE=> A palindrome number is a number which reads the same way in both directions(forward and backward) | |
//example-1: 878 is a palindrome number since it is 878 whether we read it from right or left | |
//example-2: -55 is not a palindrome because if we read it backward, it will be 55- | |
function isPalindrome(number) { | |
//TODO | |
} | |
//true | |
// console.log(isPalindrome(55)); | |
//false | |
// console.log(isPalindrome(265)); | |
//false | |
// console.log(isPalindrome(-55)); | |
//true | |
// console.log(isPalindrome(3314133)) | |
//#endregion |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment