Grey Orange
Steag Energy Services Interview Questions and Answers
Q1. Print All Permutations of a String
Given an input string STR
, generate and print all possible permutations of the string.
Input:
str
Output:
All permutations of the input string, each on a new line.
Example:
In...read more
Q2. Longest Consecutive Sequence Problem Statement
You are provided with an unsorted array/list ARR
of N
integers. Your task is to determine the length of the longest consecutive sequence present in the array.
Expl...read more
The task is to find the length of the longest consecutive sequence in an unsorted array of integers.
Sort the array to bring consecutive numbers together
Iterate through the sorted array and keep track of the current consecutive sequence length
Update the maximum length if a longer sequence is found
Q3. Nth Fibonacci Number Problem Statement
Calculate the Nth term in the Fibonacci sequence, where the sequence is defined as follows: F(n) = F(n-1) + F(n-2)
, with initial conditions F(1) = F(2) = 1
.
Input:
The inp...read more
The program calculates the Nth Fibonacci number using a recursive formula.
The Fibonacci series starts with 1, 1, and each subsequent number is the sum of the two preceding numbers.
The program uses a recursive function to calculate the Nth Fibonacci number.
The time complexity of the program is O(2^N), which can be optimized using memoization or dynamic programming.
Q4. Reverse the String Problem Statement
You are given a string STR
which contains alphabets, numbers, and special characters. Your task is to reverse the string.
Example:
Input:
STR = "abcde"
Output:
"edcba"
Input...read more
The task is to reverse a given string containing lowercase letters, uppercase letters, digits, and special characters.
Iterate through the string from the last character to the first character and append each character to a new string.
Alternatively, you can use built-in string reversal functions or methods available in your programming language.
To solve the follow-up question with O(1) space complexity, you can use a two-pointer approach. Initialize two pointers, one at the be...read more
Q5. Rectangle Area Calculation
Given a list of rectangles, where each rectangle is represented by an array of four integers indicating its bottom-left and top-right corners, calculate the total area covered by all ...read more
Q6. Bit Set Problem Statement
You are provided with a string, termed as DIGIT_PATTERN
, which consists solely of digits. The objective is to identify the first digit that repeats in the sequence. If there's no repea...read more
Interview Process at Steag Energy Services
Top Software Engineer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month