All these challenges are adapted from Sololearn, and can be found on the Sololearn mobile app.
You're interviewing to join a security team. They want to see you build a password evaluator for your technical interview to validate the input.
Write a program that takes in a string as input and evaluates it as a valid password. The password is valid if it has at a minimum 2 numbers, 2 of the following special characters ('!', '@', '#', '$', '%', '&', '*'), and a length of at least 7 characters. If the password passes the check, output 'Strong', else output 'Weak'.
Input Format:
A string representing the password to evaluate.
Output Format:
A string that says 'Strong' if the input meets the requirements, or 'Weak', if not.
Sample Input:
Hello@$World19
Sample Output:
Strong
The password has 2 numbers, 2 of the defined special characters, and its length is 14, making it valid.
You have a box of popsicles and you want to give them all away to a group of brothers and sisters. If you have enough left in the box to give them each an even amount you should go for it! If not, they will fight over them, and you should eat them yourself later.
Given the number of siblings that you are giving popsicles to, determine if you can give them each an even amount or if you shouldn't mention the popsicles at all.
Input Format:
Two integer values, the first one represents the number of siblings, and the second one represents the number of popsicles that you have left in the box.
Output Format:
A string that says 'give away' if you are giving them away, or 'eat them yourself' if you will be eating them yourself.
Sample Input:
3 9
Sample Output:
give away
You can give the popsicles to the brothers and sisters because they would each get the same amount, 3.
You have two friends who are speaking Pig Latin to each other! Pig Latin is the same words in the same order except that you take the first letter of each word and put it on the end, then you add 'ay' to the end of that. ("road" = "oadray")
Your task is to take a sentence in English and turn it into the same sentence in Pig Latin!
Input Format:
A string of the sentence in English that you need to translate into Pig Latin. (no punctuation or capitalization)
Output Format:
A string of the same sentence in Pig Latin.
Sample Input:
"nevermind youve got them"
Sample Output:
"evermindnay ouveyay otgay hemtay"
The output should be the original sentence with each word changed so that they first letter is at the end and then -ay is added after that.
You have to get a new driver's license and you show up at the office at the same time as 4 other people. The office says that they will see everyone in alphabetical order and it takes 20 minutes for them to process each new license. All of the agents are available now, and they can each see one customer at a time. How long will it take for you to walk out of the office with your new license?
Given everyone's name that showed up at the same time, determine how long it will take to get your new license.
Input Format:
Your input will be a string of your name, then an integer of the number of available agents, and lastly a string of the other four names separated by spaces.
Output Format:
You will output an integer of the number of minutes that it will take to get your license.
Sample Input:
'Eric'
2
'Adam Caroline Rebecca Frank'
Sample Output:
40
It will take 40 minutes to get your license because you are in the second group of two to be seen by one of the two available agents.
If you are given a string of random letters, your task is to evaluate whether any letter is repeated in the string or if you only hit unique keys while you typing.
Input Format:
A string of random letter characters (no numbers or other buttons were pressed).
Output Format:
A string that says 'Deja Vu' if any letter is repeated in the input string, or a string that says 'Unique' if there are no repeats.
Sample Input:
aaaaaaaghhhhjkll
Sample Output:
Deja Vu
Your program should output 'Deja Vu' because there are many repetitions in 'aaaaaaaghhhhjkll'.
You are a secret agent, and you receive an encrypted message that needs to be decoded. The code that is being used flips the message backwards and inserts non-alphabetic characters in the message to make it hard to decipher.
Create a program that will take the encoded message, flip it around, remove any characters that are not a letter or a space, and output the hidden message.
Input Format:
A string of characters that represent the encoded message.
Output Format:
A string of character that represent the intended secret message.
Sample Input:
d89%l++5r19o7W *o=l645le9H
Sample Output:
Hello World
If you remove everything that isn't a letter or space from the original message and flip it around, you get 'Hello World'.
You want to take a list of numbers and find the sum of all of the even numbers in the list. Ignore any odd numbers.
Find the sum of all even integers in a list of numbers.
Input Format:
The first input denotes the length of the list (N). The next N lines contain the list elements as integers.
Output Format:
An integer that represents the sum of only the even numbers in the list.
Sample Input:
9
1
2
3
4
5
6
7
8
9
Sample Output:
20
If you add together 2, 4, 6, and 8 from the list, you get a sum of 20.
You write a phrase and include a lot of number characters (0-9), but you decide that for numbers 10 and under you would rather write the word out instead. Can you go in and edit your phrase to write out the name of each number instead of using the numeral?
Take a phrase and replace any instances of an integer from 0-10 and replace it with the English word that corresponds to that integer.
Input Format:
A string of the phrase in its original form (lowercase).
Output Format:
A string of the updated phrase that has changed the numerals to words.
Sample Input:
i need 2 pumpkins and 3 apples
Sample Output:
i need two pumpkins and three apples
You would update the phrase to change '2' to 'two' and '3' to 'three'.
You are trying to send a secret message, and you've decided to encode it by replacing every letter in your message with its corresponding letter in a backwards version of the alphabet. What do your messages look like?
Create a program that replaces each letter in a message with its corresponding letter in a backwards version of the English alphabet.
Input Format:
A string of your message in its normal form.
Output Format:
A string of your message once you have encoded it (all lower case).
Sample Input:
Hello World
Sample Output:
svool dliow
If you replace each letter in 'Hello World' with the corresponding letter in a backwards version of the alphabet, you get 'svool dliow'.
You want to convert the time from a 12 hour clock to a 24 hour clock. If you are given the time on a 12 hour clock, you should output the time as it would appear on a 24 hour clock.
Task:
Determine if the time you are given is AM or PM, then convert that value to the way that it would appear on a 24 hour clock.
Input Format:
A string that includes the time, then a space and the indicator for AM or PM.
Output Format:
A string that includes the time in a 24 hour format (XX:XX)
Sample Input:
1:15 PM
Sample Output:
13:15
1:00 PM on a 12 hour clock is equivalent to 13:00 on a 24 hour clock.
You are in a college level English class, your professor wants you to write an essay, but you need to find out the average length of all the words you use. It is up to you to figure out how long each word is and to average it out.
Takes in a string, figure out the average length of all the words and return a number representing the average length. Remove all punctuation. Round up to the nearest whole number.
Input Format:
A string containing multiple words.
Output Format:
A number representing the average length of each word, rounded up to the nearest whole number.
Sample Input:
this phrase has multiple words
Sample Output:
6
The string in question has five words with a total of 26 letters (spaces do not count). The average word length is 5.20 letters, rounding it up to the nearest whole numbers results in 6.
You and your friends like to share YouTube links all throughout the day. You want to keep track of all the videos you watch in your own personal notepad, but you find that keeping the entire link is unnecessary. Keep the video ID (the combination of letters and numbers at the end of the link) in your notepad to slim down the URL.
Create a program that parses through a link, extracts and outputs the YouTube video ID.
Input Format:
A string containing the URL to a YouTube video. The format of the string can be in "https://www.youtube.com/watch?v=kbxkq_w51PM" or the shortened "https://youtu.be/KMBBjzp5hdc" format.
Output Format:
A string containing the extracted YouTube video id.
Sample Input:
https://www.youtube.com/watch?v=RRW2aUSw5vU
Sample Output:
RRW2aUSw5vU