A person is getting ready to leave and needs a pair of matching socks. If there are n colors of socks in the drawer, how many socks need to be removed to be certain of having a matching pair?
Example:
Input: n = 1
Output: 2
Approach
C++
#include <bits/stdc++.h>using namespace std;int maximumDraws(int n){return n + 1;}int main(){int n = 1;cout << maximumDraws(n) << "\n";return 0;}
No comments:
Post a Comment