Skip to content

Instantly share code, notes, and snippets.

View akiltipu's full-sized avatar
👋
Open to work

Akil Mahmod Tipu akiltipu

👋
Open to work
View GitHub Profile
@thekhairul
thekhairul / removeDuplicates.py
Created April 3, 2022 04:31
Leetcode remove duplicates from sorted array with python3
def removeDuplicates(nums):
nums[:] = [x for idx, x in enumerate(nums) if idx == 0 or x != nums[idx - 1]]
return len(nums)

What Hiring Should Look Like

This is definitely not the first time I've written about this topic, but I haven't written formally about it in quite awhile. So I want to revisit why I think technical-position interviewing is so poorly designed, and lay out what I think would be a better process.

I'm just one guy, with a bunch of strong opinions and a bunch of flaws. So take these suggestions with a grain of salt. I'm sure there's a lot of talented, passionate folks with other thoughts, and some are probably a lot more interesting and useful than my own.

But at the same time, I hope you'll set aside the assumptions and status quo of how interviewing is always done. Just because you were hired a certain way, and even if you liked it, doesn't mean that it's a good interview process to repeat.

If you're happy with the way technical interviewing currently works at your company, fine. Just stop, don't read any further. I'm not going to spend any effort trying to convince you otherwise.

// Bonfire: Title Case a Sentence
// Author: @akiltipu
// Challenge: http://www.freecodecamp.com/challenges/bonfire-title-case-a-sentence?solution=function%20titleCase(str)%20%7B%0A%20%20%2F%2Fvar%20str%20%3D%20%22sHoRt%20AnD%20sToUt%22%3B%0A%20%20%2F%2Fconsole.log(str)%3B%0Astr%20%3D%20str.toLowerCase()%3B%0A%2F%2Fconsole.log(str)%3B%0Astr%20%3D%20str.split(%22%20%22)%3B%0A%2F%2Fconsole.log(str)%3B%0Afor%20(var%20i%20%3D%200%3B%20i%20%3C%20str.length%3B%20i%2B%2B)%7B%0A%09str%5Bi%5D%20%3D%20str%5Bi%5D.replace(str%5Bi%5D.charAt(0)%2C%20str%5Bi%5D.charAt(0).toUpperCase())%3B%0A%7D%0A%2F%2Fconsole.log(str)%3B%0Astr%20%3D%20str.join(%22%20%22)%3B%0A%2F%2Fconsole.log(str)%3B%0A%20%20return%20str%3B%0A%7D%0A%0AtitleCase(%22I%27m%20a%20little%20tea%20pot%22)%3B%0A
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function titleCase(str) {
//var str = "sHoRt AnD sToUt";
//console.log(str);
str = str.toLowerCase();
//console.log(str);
// Bonfire: Find the Longest Word in a String
// Author: @akiltipu
// Challenge: http://www.freecodecamp.com/challenges/bonfire-find-the-longest-word-in-a-string?solution=function%20findLongestWord(str)%20%7B%0A%20%20var%20max_len%20%3D%200%3B%0A%0A%20%20var%20new_str%20%3D%20str.split(%27%20%27)%3B%0A%20%20for%20(var%20i%20%3D%200%3B%20i%20%3C%20new_str.length%3B%20i%2B%2B)%7B%0A%09if(new_str%5Bi%5D.length%20%3E%20max_len)%7B%0A%09%09max_len%20%3D%20new_str%5Bi%5D.length%3B%0A%09%7D%0A%20%20%7D%0A%20%20return%20max_len%3B%0A%7D%0A%0AfindLongestWord(%22The%20quick%20brown%20fox%20jumped%20over%20the%20lazy%20dog%22)%3B%0A
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function findLongestWord(str) {
var max_len = 0;
var new_str = str.split(' ');
for (var i = 0; i < new_str.length; i++){
// Bonfire: Check for Palindromes
// Author: @akiltipu
// Challenge: http://www.freecodecamp.com/challenges/bonfire-check-for-palindromes?solution=function%20palindrome(str)%20%7B%0A%20%20%0A%20%20str%20%3D%20str.toLowerCase().replace(%2F%5B%5CW_%5D%2Fg%2C%20%22%22)%3B%0A%20%20%0A%20%20var%20new_str%20%3D%20str.split(%22%22).reverse().join(%22%22)%3B%0A%20%20%0A%20%20if%20(str%20%3D%3D%3D%20new_str)%7B%0A%09return%20true%3B%0A%20%20%7D%0A%20%20else%7B%0A%09return%20false%3B%0A%7D%0A%20%20%0A%7D%0A%0Apalindrome(%22eye%22)%3B
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function palindrome(str) {
str = str.toLowerCase().replace(/[\W_]/g, "");
var new_str = str.split("").reverse().join("");
// Bonfire: Factorialize a Number
// Author: @akiltipu
// Challenge: http://www.freecodecamp.com/challenges/bonfire-factorialize-a-number?solution=function%20factorialize(num)%20%7B%0A%20%20var%20factorial%3B%0A%20%20var%20mul%20%3D%201%3B%0A%20%20if%20(%20num%20%3D%3D%3D%200%20%7C%7C%20num%20%3D%3D%3D%201)%7B%0A%20%20%20%20factorial%20%20%3D%201%3B%0A%20%20%7D%0A%20%20for(var%20i%20%3D%201%3B%20i%20%3C%3D%20num%3B%20i%2B%2B)%7B%0A%20%20%20%20mul%20%3D%20mul%20*%20i%3B%0A%20%20%7D%0A%20%20factorial%20%3D%20mul%3B%0A%20%20%0A%20%20return%20factorial%3B%0A%7D%0A%0Afactorialize(5)%3B%0A
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function factorialize(num) {
var factorial;
var mul = 1;
if ( num === 0 || num === 1){
factorial = 1;