This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
http://www.careercup.com/question?id=12986664 | |
Push all the zero's of a given array to the end of the array. In place only. Ex 1,2,0,4,0,0,8 becomes 1,2,4,8,0,0,0 | |
*/ | |
#include <vector> | |
#include <iostream> | |
using namespace std; | |
void putZeroToEnd(vector<int> &vec) { | |
// i for next non-zero num index | |
// j for normal move forward index |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
http://www.careercup.com/question?id=19300678 | |
If a=1, b=2, c=3,....z=26. Given a string, find all possible codes that string can generate. Give a count as well as print the strings. | |
For example: | |
Input: "1123". You need to general all valid alphabet codes from this string. | |
Output List | |
aabc //a = 1, a = 1, b = 2, c = 3 | |
kbc // since k is 11, b = 2, c= 3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <vector> | |
#include <iostream> | |
#include <string> | |
using namespace std; | |
int main() | |
{ | |
int kase; | |
cin>> kase; | |
for (int k = 1; k <= kase; k++) |
NewerOlder