Deloitte Interview Questions
Practice with real Deloitte interview questions
01
A Software Engineer was asked
Asked in 2024
Q. How can you implement a binary search algorithm in Python? Provide an example.
Ans. A binary search algorithm efficiently finds a target value within a sorted array by repeatedly dividing the search interval in half. Below is an implementation in Python:
This implementation runs in O(log n) time complexity, making it highly efficient for large datasets.
Software EngineerCore Concept
02
A Software Engineer was asked
Asked in 2024
Q. How do you manipulate strings in Python? Write a function that reverses a string and handles edge cases like empty strings.
Ans. String manipulation is a fundamental skill in Python. You can use string slicing, concatenation, and various built-in methods to manipulate strings.
Here’s an implementation of a function that reverses a string while handling edge cases:
This function checks for None and empty string inputs and uses slicing to reverse the string efficiently.
Software EngineerCore Concept
