StoreKing Interview Questions and Answers
Q1. Base 58 Conversion Problem Statement
You are given a decimal number 'N'. Your task is to convert this number into a base 58 representation.
The Base58 alphabet is defined by the following characters: “123456789...read more
Convert a decimal number to base 58 using a specific alphabet.
Iterate through each test case and convert the decimal number to base 58 using the given alphabet.
Handle the conversion by dividing the number by 58 and taking the remainder to find the corresponding base 58 character.
Build the base 58 representation by appending the characters in reverse order.
Output the final base 58 representation for each test case.
Q2. Bird and Maximum Fruit-Gathering Problem Statement
A ninja bird can gather fruits from trees arranged in a circle. Each tree has an associated fruit value. The bird can gather all the fruits from a tree in 0.5 ...read more
The task is to find the maximum number of fruits a bird can gather within a given time frame, moving between adjacent trees.
Start from each tree and calculate the maximum fruits that can be gathered within the time frame.
Use a sliding window approach to keep track of the fruits collected while moving between trees.
Choose the starting tree that gives the maximum total fruits collected.
Example: For input N=7, M=3, ARR={2, 1, 3, 5, 0, 1, 4}, the output is 9 by starting from tree...read more
Q3. Triplets with Given Sum Problem
Given an array or list ARR
consisting of N
integers, your task is to identify all distinct triplets within the array that sum up to a specified number K
.
Explanation:
A triplet i...read more
The task is to find all distinct triplets in an array that sum up to a specified number.
Iterate through the array and use nested loops to find all possible triplets.
Use a set to store unique triplets and check if the sum equals the target sum.
Handle edge cases like duplicate elements and no valid triplets.
Return the triplets or -1 if no valid triplet exists.
Q4. Pair Sum Problem Statement
You are provided with an array ARR
consisting of N
distinct integers in ascending order and an integer TARGET
. Your objective is to count all the distinct pairs in ARR
whose sum equal...read more
Count distinct pairs in an array whose sum equals a given target.
Use two pointers approach to iterate through the array and find pairs with sum equal to target.
Keep track of visited pairs to avoid counting duplicates.
Return -1 if no such pair exists with the given target.
Q5. All Prime Numbers Less Than or Equal to N
Given a positive integer N
, your task is to return all the prime numbers less than or equal to N
.
Note:
1) A prime number is a number that has only two factors: 1 and t...read more
Return all prime numbers less than or equal to a given positive integer N.
Iterate from 2 to N and check if each number is prime using a helper function.
A number is prime if it has only 2 factors: 1 and itself.
Optimize by checking divisibility only up to square root of the number.
Q6. Running Absolute Difference in Arrays
Given an array ARR
consisting of 'N' non-negative integers, compute the running absolute difference of elements at even and odd index positions, respectively.
Input:
An int...read more
Compute running absolute difference of elements at even and odd index positions in an array.
Iterate through the array and calculate absolute difference between elements at even and odd indices.
Keep track of running absolute differences for even and odd indices separately.
Output the final running absolute differences for even and odd indices.
Top Software Developer Intern Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month