Coding
Rider
Test your retention and earn a passing score.
Test your knowledge on Python syntax, variables, lists, and loops.
Assess your skills in ES6+ syntax, asynchronous programming, and DOM interaction.
Evaluate your database query knowledge, joins, primary keys, and aggregations.
Solve common interview algorithm and data structure problems.
Write a function that takes a string input and returns the reversed string without using built-in reverse functions.
def reverse_string(s: str) -> str:
# Your code here
pass
# Test
print(reverse_string("CodingRider"))
Hint: Consider using a loop from the end of the string, or slicing: s[::-1]
Reference Solution:def reverse_string(s: str) -> str:
return s[::-1]
print(reverse_string("CodingRider"))
Given an array of integers `nums` and an integer `target`, return the indices of the two numbers such that they add up to `target`.
def two_sum(nums, target):
# Your code here
pass
print(two_sum([2, 7, 11, 15], 9))
Hint: Use a dictionary/hash map to store previously seen numbers and their indices.
Reference Solution:def two_sum(nums, target):
seen = {}
for i, num in enumerate(nums):
diff = target - num
if diff in seen:
return [seen[diff], i]
seen[num] = i
return []
print(two_sum([2, 7, 11, 15], 9))
Write a JavaScript function that determines whether a given word or phrase reads the same backward as forward.
function isPalindrome(str) {
// Your code here
}
console.log(isPalindrome("racecar")); // true
console.log(isPalindrome("coding")); // false
Hint: Remove non-alphanumeric characters, lowercase the string, and compare it to its reversed version.
Reference Solution:function isPalindrome(str) {
const cleaned = str.toLowerCase().replace(/[^a-z0-9]/g, "");
return cleaned === cleaned.split("").reverse().join("");
}
console.log(isPalindrome("racecar"));
console.log(isPalindrome("coding"));