# Practice Technical Interview

Just came across this site today:

https://interviewing.io/

I haven’t tried it yet but it sounds interesting.

# Practice interviews with engineers from top companies, anonymously.

Become awesome at interviews, get fast-tracked at amazing companies, and land your next job, all in one place.

They also say that they are free and will always be free.

It’s always hard to know how to prepare for a technical interview when you are trying to get your foot in the door. Different companies also handle their interviews differently. Different positions will also require different questions based on the technologies they use. It can be overwhelming! If this site is all they say they are, then it’s an awesome place to practice and get comfortable answering technical questions.

When signing up, I get this message, so maybe they are limiting their users:

# Thank you! We’re in private beta for now, but we’ll email you when you’re up!

In the meantime, if you haven’t done many technical interviews in the wild and aren’t sure what to expect, we recommend practicing on Interview Cake.There, you can work on algorithmic problems at your own pace and get nice hints as you go.

To give you an idea about what to expect on interviewing.io, so far our platform focuses on CS fundamentals, data structures, and algorithms, similar to the kinds of topics you might see in a real technical interview at a top company for a backend or full-stack role.

Worth checking out!

Received some great links to prepare for a technical interview. Here are just a handful that may help:

Questions you, as a developer, can ask at your next interview: https://github.com/ChiperSoft/InterviewThis

# Ruby Algorithm Interview Challenge

I recently had a Junior Ruby Developer interview where I had to complete a coding challenge live. I didn’t finish in time and didn’t get the position, but I wanted to complete it anyway.

The Challenge:

Convert numbers into their word equivalent.

ie. 1 = “one”, 23 = “twenty three”, 1234 = “one thousand two hundred thirty four”

My Solution:

```def convert_num(num)
ones = {
'1' => "one",
'2' => "two",
'3' => "three",
'4' => "four",
'5' => "five",
'6' => "six",
'7' => "seven",
'8' => "eight",
'9' => "nine"
}

teens = {
'11' => "eleven",
'12' => "twelve",
'13' => "thirteen",
'14' => "fourteen",
'15' => "fifteen",
'16' => "sixteen",
'17' => "seventeen",
'18' => "eighteen",
'19' => "nineteen"
}

tens = {
'10' => "ten",
'20' => "twenty",
'30' => "thirty",
'40' => "forty",
'50' => "fifty",
'60' => "sixty",
'70' => "seventy",
'80' => "eighty",
'90' => 'ninety'
}

hundreds = {
'100' => "one hundred",
'1000' => "one thousand"
}

big_num = []
#first check ones place
string_num = num.to_s
if ones.include?(string_num)
ones[string_num]
#check teens
elsif teens.include?(string_num)
teens[string_num]
#check tens
elsif tens.include?(string_num)
tens[string_num]
#check hundreds
elsif hundreds.include?(string_num)
hundreds[string_num]
#split the number up
else
num_array = string_num.split('')
if num_array.length == 4
big_num << ones[num_array[0]] + " thousand"
big_num << ones[num_array[1]] + " hundred"
big_num << tens[num_array[2] + '0']
big_num << ones[num_array[3]]
elsif num_array.length == 3
big_num << ones[num_array[0]] + " hundred"
big_num << tens[num_array[1] + '0']
big_num << ones[num_array[2]]
else
big_num << tens[num_array[0] + '0']
big_num << ones[num_array[1]]
end
big_num.join(" ")
end

end
```

How I approached this challenge (my thinking process):
I was told that the highest number passed into this algorithm would be 9,999

1. First I knew I needed to create a list of all the numbers and their written equivalent. Since the keys would not match an array index sequence, I decided to store the information in a hash.
2. The ones place is its own hash because I knew I would need to use this hash again when dealing with hundreds and thousands.
3. I placed the teens in their own hash because there’s no pattern to the written form and would only be used if one if the numbers in the teens hash appeared.
4. Same goes for the tens. Twenty is different from two and thirty is different from three. So they get their own hash as well.
5. If the number being passed matches exactly with any of the keys in these hashes, then I just need to use that key to grab the value and output it.
6. If the number being passed does NOT match with any of the keys in my hashes, then I want to split the number up and search through the array created.
7. If the length of the array is 4 (has 4 digits), then I know I need to add the word “thousand” after the first index (0), and “hundred” after the second index (1). I push these in order into a new array called big_num.
8. The tens place is tricky as the numbers are all single digits. I add a ‘0’ to the end of the digit and search my tens hash for the matching key.
9. I follow this same pattern for numbers that have a length of 3 and numbers with a length of 2.
10. Then I join the elements in big_num together so that they form one string.

The following tests and outputs:

```p convert_num(3)
=> "three"
p convert_num(15)
=> "fifteen"
p convert_num(90)
=> "ninety"
p convert_num(45)
=> "forty five"
p convert_num(202)
=> "two hundred two"
p convert_num(100)
=> "one hundred"
p convert_num(1200)
=> "one thousand two hundred"
p convert_num(9999)
=> "nine thousand nine hundred ninety nine"
```

Pretty sure that there can be some more refactoring, but will have to keep working through the logic to find a way to simplify it.

# Front-End Interview Questions

I have started applying to junior web developer positions to see if I have the necessary skills to start working. Today I had a call with a recruiter who asked me several questions that I didn’t know the answer to. The position she was trying to place me in was a front-end role so the questions are more geared towards the front-end development of web applications.

The questions:

1. What are CSS sprites?
CSS sprites are a way to combine multiple images into one image file to help performance. This way, you only need to load your images with one HTTP request.
Read more on sprites and how to implement them here.
2. What is the difference between px and em?
• px stands for pixels and each pixel represents a dot on your computer screen. Pixels are fixed-size units which means that they are not scale-able to tablets and mobile devices. It’s great to use px for your styling and design, but not for font sizes.
• em is best to use for scaling font sizes because it adapts to all devices and is very mobile friendly. 1em = default document font size (usually 12pt).

Kyle Schaeffer explains it best.

3. What is the difference between visibility: hidden and display: none?
• visibility: hidden hides the element, but the element will still affect the layout and take up the same space.
• display: none does NOT occupy space on a page. It’s like the element has been removed.

4. What are some JavaScript libraries you’ve used?
DOM: jQuery, Prototype, MooTools, Dojo
Web Application Frameworks: Meteor.js, Angular.js, React.js, Ember.js
GUI: Bootstrap, jQuery UI
See more here.
5. What do you do when a browser can’t display HTML5?
You can make a separate view for browsers that can’t render HTML5. You can also add JavaScript elements to display what you need in case HTML5 isn’t rendered.
Test if a user’s browser has HTML5 capabilities with Modernizr.js (another JavaScript library!).
Guide to making Internet Explorer display your HTML5 elements with JavaScript.