Logical Coding Questions Asked in Interviews
- Find the subset having total is zero
Input : [4,2,-6,3,3,-6]
- Reverse a word
Input : I am an Indian
Output: I ma na naidnI
- Sort fruit name by count and with int
Input : ["apple","mango","orange","apple","apple","orange","apple"]
Output :
apple-4
orange-2
mango-1
- Find out second largest number
- Consecutive string
Input : aaabbcda
Output: a:3,b:2,c:1,d:1,a:1
- Even-Odd number using goroutines
- Two sum problem
Input : [1,5,6,7,2] Target : 6
Output: [0,1] print indexes.
- Find the median
- Find the unique elements from array
Input : [1,5,6,7,5,1]
Output: 1,5,6,7
- Return unique elements from array using map
- Count the number of strings from array
Input : [“I am an Indian”]
Output: 4
- Keep adding the individual digits of the sum until it’s a single digit
Input : 54321
Output: 6
Exp : 5+4+3+2+1 = 15 = 1+5 = 6
- Merge and get sorted unique linked list
Input :
List1 = head → 4 → 50 → 12 → NULL
List2 = head → 10 → 1 → 60 → NULL
Output: head → 1 → 4 → 10 → 12 → 50 → 60
- Find min and Max sum if I choose any 4 elements in this array
Input : arr :[] {1,3,5,7,9}
Output should be Minimum 16, maximum 24
- Valid anagram https://leetcode.com/problems/valid-anagram/
- Find happy number https://leetcode.com/problems/happy-number/
- Implement Binary search tree in golang
- Implement Queue example in golang
- Can you write a program, structure 2 goroutine, each go routine should increment value simultaneously
- Can you write a program for Last-In-First-Out? (for stack = push, pop)
- Reverse a string using defer
- Merge two array and sort it
- Merge two array and find highest and lowest
- Check sub array string present or not
- Reverse a string - “golang” —> “gnalog”
- Random number https://go.dev/play/p/oH53qVBvWUb
- Print output
Input :
arr1 []{5,10,30,45,50}
arr2 []{3,7,15,25,55}
Output :
5,7,15,25,55
10,15,25,55
30,55
45,55
50,55
-
Store unique words only https://go.dev/play/p/0bmPCqCE_6I
-
Design an API to print the list of users along with their posts API response Format: {UserName : "” , Posts[] } https://go.dev/play/p/2FqYHuMLIkG
-
Write a program to communicate between two goroutines