Coding Assessment Questions

This will be a document of all the coding questions I experience during coding interviews!

If you have any questions or want further explanation, please reach out to me on Instagram at: @thecodingempire.

Sort a word in alphabetical order (without using a built-in sort method).

There will only be letters in the string (no numbers of punctuation symbols)

def sortLetters(strParam):
	if strParam == "": #base case call
		return strParam
	strAns = strParam[0] #starts off strAns with something
	for i in range(1, len(strParam)): #loops for all unaccounted letters of strParam
		strAns = putLetter(strAns, strParam[i])
	return strAns
	
def putLetter(strAns, letter):
	idx = len(strAns)-1 #starts the loop from the end of the string
	while (idx >= 0):
		if (strAns[idx] < letter): #checks to see if this is the spot to insert letter
			return strAns[0:idx+1] + letter + strAns[idx+1:] #inserts letter
		idx -= 1 
	return letter + strAns #letter is less than all letters in word already, add to front
	
sortLetters(input()) #calls the function with parameters entered by the user

Find the number of minutes between two times

Each time will be formatted as “:__am/pm-:_am/pm”

def timeCalculate(strParam):
	strLst = strParam.split(":") #creates a list of size 2 with the times needed
	beginTime, endTime = strLst #sets the begin and end times
	minBeginTime = convertToNum(beginTime)
	minEndTime = convertToNum(endTime)
	if minEndTime < minBeginTime: #goes into next day, must calculate the amount of time
																#left today and the amount of time into tomorrow
		return 24*60 - minEndTime + minBegimTime
	return minEndTime - minBeginTime #otherwise, simple calculation based on military time
	
def convertToNum(time):
	colonIdx = time.find(":") #hard-coded the determination of hours and minutes in time
	hours = int(time[:colonIdx])
	minutes = int(time[colonIdx+1:len(time)-2])
	if "pm" in time:
		if hours < 12:
			hours += 12 #using military time for easier handling of difference
	return 60 * hours + minutes #converts the time into minutes past midnight

timeCalculate(input()) #calls the function with parameters entered by the user

Custom Search

Given a number, n, sum up all multiples of 3 and 5 that occur [0, n).

def customSort(num):
	 multiples = set()
	 
	 for i in range(num): #loop in range [0, *n*)
		 if i % 3 == 0:
			 if i not in mulitples: #checks to see if multiple was already included 
				 multiples.add(i) #adds if not in set
		 elif i % 5 == 0:
			 if i not in multiples: #this can be optimized more because sets will not
				 multiples.add(i)     #have multiple instances of a number (no need for
				                      #if statment checking if number is in set).
				                       
		multiples = [*multiples] #converts the set into a list for sum calculation
		
		return sum(multiples) #uses built-in sum method to calculate sum
		
print(customSort(input())) #calls the method and prints answer

Coding Roadmap

Here’s the roadmap I would follow if I had to start programming all over again

  1. Learn Java and Python
    1. Online resources:
      1. https://www.freecodecamp.org/
      2. https://www.codecademy.com/
    2. Data Structures and Algorithms
      1. Strings, Int, Char, Booleans
      2. Conditionals, For-loops, While-loops
      3. Arrays/Lists
      4. Sets, Queues, and Maps/Dictionaries
      5. Search and Sort Algorithms
      6. Graphs and Trees
  2. Learn HTML, CSS, and JavaScript
    1. Create first portfolio website
      1. Search online for a tutorial and follow that!
    2. JavaScript Websites
      1. 30 JavaScript Projects in 30 Days
    3. JavaScript Projects
      1. https://www.codewithantonio.com/
  3. For frontend: React.JS and Tailwind
    1. Create a new portfolio website
    2. https://www.youtube.com/@javascriptmastery
  4. Next.JS, TypeScript, Angular, Flask
    1. MERN
      1. Canva.com clone: https://www.youtube.com/watch?v=Ahwoks_dawU&t=5342s
      2. Zoom clone: https://www.youtube.com/watch?v=R8CIO1DZ2b8
  5. What’s Next for Me
    1. Agile
    2. C/C++
    3. Django

Finding a SWE Internship