Common interview question

 Reverse string , Reverse array, Palindrome
vector , list , set and map implementation
go through alogrithm.h functions and map.h, vector.h, set.h, bitset.h, string.h and list.h
API functions, operator functons of map, vector and list
accessing index of list. map and vector and printing
modifying the value at the index of list, map and vector
finding the key and modifying the value in a map
deleting the entry in map, list and vector

missin integer, consecutive number in arrays

#include <iostream>
#include <vector>
#include <map>
#include <numeric>
#include <algorithm>
using namespace std;
int main()
{
  std::map<int, int> m;
  std::vector v{1,2,3,5,6};
  for(auto &x: v)
  {
     m[x]++;
  }
  for(int i=1; i <= v[v.size() -1]; i++)
  {
      if(m[i] < 1)
      {
          std::cout << "missing integer is:" << i <<std::endl;
      }
      
  }
}

Comments

Popular posts from this blog

GlobalLogic Interview

Motorola(Dynamic Technologies) Kolkata

Euronet interview questions