Meta Interview Questions
Practice with real Meta interview questions
01
A Software Engineer was asked
Asked in 2025
Q. Demonstrate how to reverse a string in Java without using built-in methods.
Ans. To reverse a string in Java without using built-in methods like
StringBuilder.reverse(), you can use a character array. Here's how:
This code effectively reverses the string by swapping characters from the ends towards the center, ensuring O(n) time complexity.Software EngineerCore Concept
02
A Software Engineer was asked
Asked in 2025
Q. Write a function in Python to find the longest substring without repeating characters in a given string.
Ans. To find the longest substring without repeating characters, you can use a sliding window approach with two pointers. Here's how you can implement this in Python:
This function iterates over the string with the
right pointer, while the left pointer marks the start of the current substring without duplicates. The dictionary char_map keeps track of the last occurrence of each character. When a duplicate character is found within the current window, the left pointer moves to the right of the last occurrence of that character to ensure all characters in the window are unique. The longest substring is updated accordingly.Software EngineerCore Concept
