11. Find the Number of Digits in a Given Integer Without Using Strings
Required Input:
n = 34567Expected Output:
5
Code In Python
def count_digits(n):
# Write your logic here
pass
# Prefilled input
n = 34567
print(count_digits(n))
Run Code?
Click Run Button to view compiled output
12. Check If a Given Number is Prime
Required Input:
n = 29Expected Output:
True
Code In Python
def is_prime(n):
# Write your logic here
pass
# Prefilled input
n = 29
print(is_prime(n))
Run Code?
Click Run Button to view compiled output
13. Find the Two Non-Repeating Elements in an Array
Required Input:
nums = [2, 4, 6, 8, 4, 2, 10, 6]Expected Output:
[10, 8]
Code In Python
def find_two_unique(nums):
# Write your logic here
pass
# Prefilled input
nums = [2, 4, 6, 8, 4, 2, 10, 6]
print(find_two_unique(nums))
Run Code?
Click Run Button to view compiled output
14. Divide Two Integers Without Using Division (/) or Modulus (%)
Required Input:
a = 43, b = 8Expected Output:
5
Code In Python
def divide(a, b):
# Write your logic here
pass
# Prefilled input
a = 43
b = 8
print(divide(a, b))
Run Code?
Click Run Button to view compiled output
15. Find the Square Root of a Number Without Using Built-in Functions
Required Input:
n = 50Expected Output:
7
Code In Python
def integer_sqrt(n):
# Write your logic here
pass
# Prefilled input
n = 50
print(integer_sqrt(n))
Run Code?
Click Run Button to view compiled output
16. Find the N-th Fibonacci Number Using Matrix Exponentiation
Required Input:
n = 10Expected Output:
55
Code In Python
def fibonacci_matrix(n):
# Write your logic here
pass
# Prefilled input
n = 10
print(fibonacci_matrix(n))
Run Code?
Click Run Button to view compiled output
17. Find the Sum of All XOR Pairs in an Array
Required Input:
nums = [1, 2, 3]Expected Output:
6
Code In Python
def sum_xor_pairs(nums):
# Write your logic here
pass
# Prefilled input
nums = [1, 2, 3]
print(sum_xor_pairs(nums))
Run Code?
Click Run Button to view compiled output
18. Find the Maximum XOR of Two Numbers in an Array
Required Input:
nums = [3, 10, 5, 25, 2, 8]Expected Output:
28
Code In Python
class TrieNode:
def __init__(self):
self.children = {}
class Trie:
def __init__(self):
self.root = TrieNode()
def insert(self, num):
# Write your logic here
pass
def find_max_xor(self, num):
# Write your logic here
pass
def max_xor(nums):
# Write your logic here
pass
# Prefilled input
nums = [3, 10, 5, 25, 2, 8]
print(max_xor(nums))
Run Code?
Click Run Button to view compiled output
19. Find the Number of Valid Squareful Permutations in an Array
Required Input:
nums = [1, 17, 8]Expected Output:
2
Code In Python
from itertools import permutations
def is_square(n):
# Write your logic here
pass
def squareful_perms(nums):
# Write your logic here
pass
# Prefilled input
nums = [1, 17, 8]
print(squareful_perms(nums))
Run Code?
Click Run Button to view compiled output
20. Find the N-th Catalan Number Using Dynamic Programming
Required Input:
n = 5Expected Output:
42
Code In Python
def catalan_number(n):
# Write your logic here
pass
# Prefilled input
n = 5
print(catalan_number(n))
Run Code?
Click Run Button to view compiled output


