Practice Real Company Assessment Patterns • Latest 2025–2026 Mock Tests

Programming Exercises

Implement a function to check if two strings are rotations of each other.

Medium

Problem Statement

Implement a function to check if two strings are rotations of each other.

Sample Input

"abcd", "dabc"

Sample Output

true

Limits

Time: 2s · Memory: 256 MB

Code Editor
00:00
import java.util.*; public class Main { public static boolean areRotations() { String str1 = "abcd"; String str2 = "dabc"; // Your code here return false; } }
Log in or sign up to run or submit your code.Log inSign up
Input
"abcd", "dabc"
Expected Output
true