Biweekly coding interview practice. It’s free
Here’s how it works:
- Sign up to receive a real interview question in your mailbox twice a week.
- Try to solve the problem! It’s fun and sharpens your interviewing skills.
- We’ll post the solutions on github. The solutions will be posted in Python and Go. You are free to contribute to the solutions in other languages.
A sample problem
Palindrome Check Write a function that takes in a non-empty string and that returns a boolean representing whether or not the string is a palindrome. A palindrome is defined as a string that is written the same forward and backward. Sample input: "abcdcba" Sample output: True (it is a palindrome)
Solution
func IsPalindrome(str string) bool { for i := 0; i <= len(str)/2; i++ { if str[i] != str[len(str)-i-1] { return false } } return true }
Social Profiles