This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Note: Try to solve this task in-place (with O(1) additional memory), since this is what you'll be asked to do during an interview. | |
| You are given an n x n 2D matrix that represents an image. Rotate the image by 90 degrees (clockwise). | |
| Example | |
| For | |
| a = [[1, 2, 3], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <style> | |
| body { | |
| background-color: lightgreen; | |
| } | |
| @media only screen and (max-width: 400px) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| mkdir myDirName #this is the name of your directory | |
| cd /myDirName | |
| git init | |
| touch readME.md #this is to create an initial file to push | |
| git commit -m "enter commit message here" | |
| git remote add origin git@github.com:YOUR_USERNAME/myDirName.git | |
| curl -u USERNAME:PASSWORD https://api.github.com/user/repos -d '{"name":"myDirName"}' #this will create the repo in github. | |
| # if you haven't generated and SSH key for github access then follow these steps, otherwise you're good to push your shit to github. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| The following English text was encrypted using a substitution cipher that shuffles the alphabet rather than just shifting it. | |
| Can you find what the following letters l and h stand for in the following text ? | |
| hm al, mo tmh hm al, huvh gn hul jzlnhgmt: | |
| qulhulo 'hgn tmaxlo gt hul cgty hm nzrrlo | |
| hul nxgtsn vty voomqn mr mzhovslmzn rmohztl, | |
| mo hm hvel vocn vsvgtnh v nlv mr homzaxln | |
| vty ak mppmngts lty hulc? | |
| hm ygl: hm nxllp; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Brute-force the following Caesar’s cipher, and find | |
| the plaintext and key of the following | |
| message: kyvtrmrcipnzccrkkrtbwifdkyvefikynvjkrkeffe | |
| """ | |
| alphabet = "abcdefghijklmnopqrstuvwxyz" | |
| def encrypt(plaintext, k): | |
| ciphertext = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| The function check_password(password) is used by a safe with 4-digits passwords, and is | |
| susceptible to timing attacks. More specifically, it takes it around 0.1 seconds to check | |
| one digit – so brute-forcing all the possible combinations will take around 1,500 hours. | |
| Can you implement a way to crack its password in less than a minute? | |
| """ | |
| import time | |
| import sys # ignore |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Implement Caesar’s cipher: implement a function encrypt that | |
| given a plaintext string and a key 𝑘 (how many letters to shift), | |
| returns a ciphertext where each character is shifted 𝑘 places. | |
| (You can assume all characters are lowercase letters, with no punctuation or spaces.) | |
| """ | |
| alphabet = 'abcdefghijklmnopqrstuvwxyz' | |
| def encrypt(plaintext="hithere", k=4): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 1) Piano Genie article | |
| https://arxiv.org/abs/1810.05246 | |
| 2) Neural Translation of Musical Style | |
| https://arxiv.org/abs/1708.03535 | |
| 3) Google’s AI-powered Piano Genie lets anyone improvise perfectly by bashing buttons | |
| https://www.theverge.com/2018/10/16/17982596/google-magenta-ai-piano-genie-improvisation-neural-networks | |
| 4) Piano Genie: An Intelligent Musical Interface |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Script: | |
| curl -s https://api.github.com/users/user/repos | grep \"clone_url\" | awk '{print $2}' | sed -e 's/"//g' -e 's/,//g' | xargs -n1 git clone | |
| More info: | |
| https://blog.scottlowe.org/2018/07/19/cloning-all-repositories-in-a-github-organization/ |