How many permutations are possible for a set of n elements?
In how many ways can you arrange the letters in the word "COMBINATORICS"?
How many different 3-digit numbers can be formed using the digits 1, 2, 3, 4, 5 without repetition?
How many subsets can be formed from a set with n elements?
How many ways can you choose a president, vice president, and treasurer from a group of 10 people?
What will be the output of the following code?
#include <iostream>
using namespace std;
int main() {
int n = 5;
int result = 1;
for (int i = n; i >= 1; i--) {
result *= i;
}
cout << result << endl;
return 0;
}
What will be the output of the following code?
#include <iostream>
using namespace std;
int main() {
int n = 4;
int result = 1;
for (int i = 1; i <= n; i++) {
result *= i;
}
cout << result << endl;
return 0;
}
What will be the output of the following code?
#include <iostream>
using namespace std;
int main() {
int n = 6;
int r = 3;
int result = 1;
for (int i = n; i >= n - r + 1; i--) {
result *= i;
}
cout << result << endl;
return 0;
}
What will be the output of the following code?
#include <iostream>
using namespace std;
int main() {
int n = 5;
int r = 2;
int result = 1;
for (int i = n; i >= n - r + 1; i--) {
result *= i;
}
cout << result << endl;
return 0;
}
What will be the output of the following code?
#include <iostream>
using namespace std;
int main() {
int n = 5;
int r = 3;
int result = 1;
for (int i = 1; i <= r; i++) {
result *= n;
n--;
}
cout << result << endl;
return 0;
}
Consider the following problem: "Given a string of lowercase English letters, count the number of substrings that start and end with the same letter." What will be the output for the input "aba"?
Ayoub's function is defined as follows:
int Ayoub(int n) {
if (n == 1) {
return 1;
}
return Ayoub(n - 1) + n;
}
What will be the output of Ayoub(4)?
The inverse factorial function is defined as follows:
int inverseFactorial(int x) {
int fact = 1;
int i = 1;
while (fact < x) {
i++;
fact *= i;
}
if (fact == x) {
return i;
} else {
return -1;
}
}
What will be the output of inverseFactorial(120)?
Consider the following problem: "There is a parking lot with n parking spaces. You can park your car in any vacant spot, but you cannot park next to another car. How many ways are there to park your car in the lot?" What will be the output for the input n = 3?
The Super Pow function is defined as follows:
int superPow(int a, vector<int>& b) {
int result = 1;
int mod = 1337;
for (int i = 0; i < b.size(); i++) {
result = (pow(result, 10) % mod * pow(a, b[i]) % mod) % mod;
}
return result;
}
What will be the output of superPow(2, {1, 0})?