24 - Coding challenges and interview questions
MicheleGoals
- Learn about the coding interview
- Go through simple coding tasks examples
- Learn where and how you can get better at it
Examples
1. Reverting a string
Print out a string in reverse order.
Examples
Input: Hello World
Ourpur: dlroW olleH
Input: This is crazy
Output: yzarc si sihT
2. Most frequent element in an array (from https://www.geeksforgeeks.org/frequent-element-array/)
Given an array, find the most frequent element in it. If there are multiple elements that appear maximum number of times, print any one of them.
Examples
Input : arr[] = {1, 3, 2, 1, 4, 1}
Output : 1
Input : arr[] = {10, 20, 10, 20, 30, 20, 20}
Output : 20
Questions Marks (from https://www.coderbyte.com/editor/Questions%20Marks:Java)
Have the function QuestionsMarks(str) take the str string parameter, which will contain single digit numbers, letters, and question marks, and check if there are exactly 3 question marks between every pair of two numbers that add up to 10. If so, then your program should return the string true, otherwise it should return the string false. If there aren't any two numbers that add up to 10 in the string, then your program should return false as well.
For example: if str is "arrb6???4xxbl5???eee5" then your program should return true because there are exactly 3 question marks between 6 and 4, and 3 question marks between 5 and 5 at the end of the string.
Examples
Input: "aa6?9"
Output: false
Input: "acc?7??sss?3rr1??????5"
Output: true
Additional Resources
Interactive code challenges
- https://www.hackerrank.com/dashboard, a nice platform for coding challenges and learning in general
- https://leetcode.com/problemset/all/ is full of coding interview problems, and they recently added a learning platform
- https://edabit.com/challenges/java, more coding challenges
- https://codingbat.com/java
- https://coderbyte.com/
Other resources
- https://www.softwaretestinghelp.com/java-coding-interview-programs/
- https://javarevisited.blogspot.com/2017/07/top-50-java-programs-from-coding-Interviews.html