diff --git a/Submission/Prashant Pandey/Power of Two/Power Of Two.png b/Submission/Prashant Pandey/Power of Two/Power Of Two.png new file mode 100644 index 0000000..1944fe0 Binary files /dev/null and b/Submission/Prashant Pandey/Power of Two/Power Of Two.png differ diff --git a/Submission/Prashant Pandey/Power of Two/solution.c b/Submission/Prashant Pandey/Power of Two/solution.c new file mode 100644 index 0000000..c66cf72 --- /dev/null +++ b/Submission/Prashant Pandey/Power of Two/solution.c @@ -0,0 +1,8 @@ +#include + +bool isPowerOfTwo(int n) { + if (n <= 0) { + return false; + } + return (n & (n - 1)) == 0; +} diff --git a/Submission/Prashant Pandey/missing number/Missing Number.png b/Submission/Prashant Pandey/missing number/Missing Number.png new file mode 100644 index 0000000..126d190 Binary files /dev/null and b/Submission/Prashant Pandey/missing number/Missing Number.png differ diff --git a/Submission/Prashant Pandey/missing number/solution.c b/Submission/Prashant Pandey/missing number/solution.c new file mode 100644 index 0000000..2933b81 --- /dev/null +++ b/Submission/Prashant Pandey/missing number/solution.c @@ -0,0 +1,11 @@ +int missingNumber(int* nums, int numsSize){ + int expectedSum = numsSize * (numsSize + 1) / 2; + int actualSum = 0; + + for (int i = 0; i < numsSize; i++) { + actualSum += nums[i]; + } + + return expectedSum - actualSum; + +} \ No newline at end of file