Practice Resources
Programs
The programs are listed in no specific order.
- is prime number: A program that takes in a number
and outputs whether its a prime number or not. - factors: Take in a number from user. Output all of its factors.
- n-th factorial: A program that takes in a number
and outputs n-th factorial. - is perfect number: A program that takes in a number
and outputs whether its a perfect number. - fibonacci numbers: A program that takes in a number
and prints all fibonacci numbers less than or equal to . - determinant of matrix: Take in a matrix from user. Output the determinant
of the matrix. First try for
. Then go higher-ordered matrices. - pascal’s triangle: Take
from user input. Print pascal’s triangle to rows. - is valid palindrome: Take a string input from user. Output if the input
is palindrome or not. A phrase is a palindrome if, after converting all
uppercase letters into lowercase letters and removing all non-alphanumeric
characters, it reads the same forward and backward. Alphanumeric characters
include letters and numbers. Try not to use
[::-1]
. - armstrong numbers: Take
from user input. Print all armstrong numbers (in base 10, of course) between 0 and (inclusive). - letter analysis: Take a text input from user. Find how many times each
letter is being used in that string. Use a
dictionary
to store the data. Output the final results. Try to read the text from a.txt
file as well. - word length analysis: Take a string input from user. Print length of
each word separated by a space. Try to include the summary using a
dictionary
. - letter expanding: A program that converts b3j8k2 to bbbjjjjjjjjkk. The number can be 1 to 99.
- binary addition: Take in 2 numbers in binary (as strings) and output the
sum of both numbers. Try not to use
bin
function. - big integer addition: Given a very large integer represented as a
list, where each
digits[i]
is thedigit of the integer. The digits are ordered from most significant to least significant in left-to-right order. Increment the large integer by one and return the resulting array of digits. Don’t construct a int
object. - stack implementation
- queue implementation
Platforms
- Codewars - https://codewars.com (my most preferred one)
- HackerRank - https://hackerrank.com
- Leetcode - https://leetcode.com (my least preferred one)