/practice-questions-01

VT Programming team lecture 2016.02.16

Primary LanguageJava

VT Programming team lecture 2016.02.16

Multiples of 3 and 5

Time Limit: 2 seconds

Project Euler 1: https://projecteuler.net/problem=1

If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.

Given some number N, what is the sum of all multiples of three and five that are strictly less than N?

Input
Each input will consist of a single integer on a single line giving N(10≤N≤10,000)N(10≤N≤10,000).

Output
Output a single number on a single line, giving the sum of all multiples of 3 or 5 below N.

Sample Input 1 10
Sample Output 1
23
Sample Input 2 1000
Sample Output 2
233168
Sample Input 3 381
Sample Output 3
33758

Anagrams

Time Limit: 2 seconds

This problem will ask you to recognize if two strings are anagrams of each other. Two strings are anagrams of each other if you can rearrange the letters of one to make the other (They have exactly the same letters, order not mattering).

Input
Input will consist of a single test case. You will be provided with two strings, aa and bb. Both strings will consist of lowercase alphabetical characters only.

Output
Print “‘true”’ if aa and bb are anagrams of each other, “‘false”’ otherwise.

Sample Input 1 tommarvoloriddle
iamlordvoldemort

Sample Output 1
true

Sample Input 2 zigging
zagging

Sample Output 2
false

#Removing Duplicates Time Limit: 2 seconds

You will be provided a list of integer numbers, you must output these numbers in the order you recieve them, but making sure you remove any duplicates.

Input
Input will consist of one test case. Input will begin with a single integer N, that will specify the number of integers that will be in the list. This will be followed by N integers on a single line.

Output
Output the numbers in the order they appear in the input, but removing the duplicate entries.

Sample Input 1 10
2 3 5 1 2 4 1 5 2 6

Sample Output 1
2 3 5 1 4 6