Find kth smallest number in range [ 1 , n ] when all the odd numbers are deleted | C ++ implementation of the approach ; Function to return the kth smallest element from the range [ 1 , n ] after removing all the odd elements ; Driver code
#include <bits/stdc++.h> NEW_LINE using namespace std ; int kthSmallest ( int n , int k ) { return ( 2 * k ) ; } int main ( ) { int n = 8 , k = 4 ; cout << kthSmallest ( n , k ) ; return 0 ; }