Home
Write a function that determines if each characters in a String appear no more than once.
Related Tags: Strings
A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself. A natural number greater than 1 that is not a prime number is called a composite number. Given an input value check if it's a prime.
Related Tags: Math
Write a function that checks to see if two Strings are anagrams of each other. Hint: an anagram of a word is one that has the same characters in it, but in a different sequence e.g. "listen" and "silent."
Related Tags: Strings
Albert and Bernard became friends with Cheryl, and they want to know when her birthday is. Cheryl gives them a list of 10 possible dates.
May 15 | May 16 | May 19 |
June 17 | June 18 | |
July 14 | July 16 | |
August 14 | August 15 | August 17 |
Cheryl then tells Albert and Bernard separately the month and day of her birthday respectively.
So when is Cheryl's birthday?
Related Tags: Brain Teasers
The decimal number 585 = 1001001001 (binary) is palindromic in both bases.
Find the sum of all numbers, less than one million, which are palindromic in base 10 and base 2.
Write a function that computes the list of the first 100 Fibonacci numbers.
Related Tags: Arrays
Given a number, return all the prime factors and their corresponding number of occurrences.
Related Tags: Math
Write a program that prints the numbers from 1 to 100. But for multiples of three print "fizz" instead of the number and for the multiples of five print "buzz". For numbers which are multiples of both three and five print "fizzbuzz." Apparently this question is used to weed out 99.5% of candidates. Be sure to know this one!
Related Tags: Coding
Write a function that returns the list of all primes less than n.
It was proposed by Christian Goldbach that every odd composite number can be written as the sum of a prime and twice a square. For example,
It turns out the conjecture was false. What is the smallest odd composite that cannot be written as the sum of a prime and twice a square?
Related Tags: Math
The sequence of triangle numbers is generated by adding the natural numbers. So the 7th triangle number would be 1 + 2 + 3 + 4 + 5 + 6 + 7 = 28. The first ten terms would be:
Let us list the factors of the first seven triangle numbers:
We can see that 28 is the first triangle number to have over five divisors.
What is the value of the first triangle number to have over five hundred divisors?
Related Tags: Math
Write a function that returns the index of where a substring begins within a given string. Return -1 if it doesn't exist.
Related Tags: Strings
If p is the perimeter of a right angle triangle with integral length sides, {a,b,c}, there are exactly three solutions for p = 120: {20,48,52}, {24,45,51}, and {30,40,50}.
Related Tags: Math
Define a method that checks if a given singly Linked List is a palindrome.
Related Tags: Linked Lists
Remove all duplicates that occur in a linked list.
Related Tags: Linked Lists
Reverse any given Linked List.
Related Tags: Linked Lists
Find the longest palindrome substring that exists within a string.
Related Tags: Bioinformatics Strings
You are given 9 balls. 8 of them weigh the same while 1 is heavier than the others. How can you determine which ball is the odd one out using just two comparisons?
Related Tags: Brain Teasers
Write a function that finds the first non-repeated character in a String.
Related Tags: Strings
If a canoe can hold 2 kids and a maximum weight of 150 pounds, write a function that returns the minimum number of canoes needed
Related Tags: Coding
Print all permutations of a String iteratively.
Related Tags: Strings
Euler discovered the remarkable quadratic formula:
It turns out that the formula will produce 40 primes for the consecutive values n = 0 to 39. However, when n = 40, 402 + 40 + 41 = 40(40 + 1) + 41 is divisible by 41, and certainly when n = 41, 412 + 41 + 41 is clearly divisible by 41.
The incredible formula n2 − 79n + 1601 was discovered, which produces 80 primes for the consecutive values n = 0 to 79. The product of the coefficients, −79 and 1601, is −126479.
Considering quadratics of the form:
where |n| is the modulus/absolute value of ne.g. |11| = 11 and |−4| = 4
Find the product of the coefficients, a and b, for the quadratic expression that produces the maximum number of primes for consecutive values of n, starting with n = 0.
Related Tags: Math
Write a method that will remove any given character from a string.
Related Tags: Strings
Write a function that returns the largest item in a list.
Write a function that reverses a string in place.
Related Tags: Strings
Rotate a 2d array in place.
Implement a method that checks whether a string is a palindrome or not.
Related Tags: Strings
Write three functions that compute the sum of the numbers in a list using a for-loop.