Skip to content

Latest commit

 

History

History
42 lines (28 loc) · 2.7 KB

File metadata and controls

42 lines (28 loc) · 2.7 KB

Algorithm Challenges

  1. Sum Squares:

    • Prompt: Design a function that takes a positive integer as input and calculates the sum of the squares of all positive integers up to and including the given input.
  2. Invert Values:

    • Prompt: Implement a function that takes an array of numbers and returns a new array with the sign of each element inverted.
  3. Reversed Strings without Inbuilt Methods:

    • Prompt: Write a function that takes a string as input and returns the reverse of the string without using inbuilt methods like split, reverse, and join.
  4. Find Smallest Integer:

    • Prompt: Create a function that takes an array of integers and returns the smallest positive integer not present in the array.
  5. Counting Sheep:

    • Prompt: Write a function that takes a list of boolean values representing sheep, where true indicates that a sheep is present. Return the total number of sheep present (true values).
  6. Calculate Average:

    • Prompt: Design a function that takes an array of numbers and returns the average (mean) of the numbers.
  7. isPalindrome:

    • Prompt: Implement a function that takes a string as input and returns true if the string is a palindrome, and false otherwise.
  8. Find the Middle Element:

    • Prompt: Create a function that takes a list of numbers and returns the middle element. If the list has an even number of elements, return the average of the two middle elements.
  9. Training on Vowel Count:

    • Prompt: Write a function that takes a string as input and returns the count of vowels in the string.
  10. Recursive Sum of an Array:

    • Prompt: Design a recursive function that takes an array of integers and returns the sum of all the elements.
  11. Find Numerically Middle Index:

    • Prompt: Design a function that takes an array of numbers as input and returns the index of the element that is numerically in the middle of the array. If the array has an even number of elements, return the index of the element closest to the average of the two middle elements.
  12. Are Anagrams:

    • Prompt: Implement a function that takes two strings as input and determines whether they are anagrams (contain the same characters with the same frequency), ignoring spaces and capitalization.
  13. Sum Diagonals:

    • Prompt: Create a function that takes a square matrix (2D array) as input and returns the sum of the two main diagonals (from the top-left to the bottom-right and from the top-right to the bottom-left).

Feel free to use this modified list for your JavaScript challenges! If you have any more questions or if there's anything else I can help you with, please let me know.