Author: admin

DE Shaw Ascend Educare Interview Experience

I was recently selected for the prestigious D E Shaw Ascend Educare Program, as one among the 40 girls from all over India. I am sharing my interview experience here so that people appearing for internships or mentorships at D E Shaw can get an insight into the process.Round 1: Essay and ResumeHey geek! It’s […]

Continue Reading

Tips to Become a Data Engineer

Data Engineering is one of the most coveted careers options today and a highly lucrative one at that. And if you are wondering what data engineering entails, what will be the growth trajectory, or how to become a data engineer, you have stumbled upon the right article. We will try to answer all these in […]

Continue Reading

Convert given Binary Tree to Symmetric Tree by adding minimum number of nodes

  #include using namespace std;  class Node {public:    int val;    Node *left, *right;    Node(int val)    {        this->val = val;        left = right = NULL;    }};  Node* buidSymmetericTree(Node* root1,                         Node* root2){        if (root1 == NULL and root2 == NULL) {        return NULL;    }          if (root1 == NULL) {                          Node* node = new Node(root2->val);        root1 = node;    }          if (root2 == NULL) {                          Node* node = new Node(root1->val);        root2 = node;    }                  if (root1->val != root2->val) {        int temp = root1->val […]

Continue Reading

Length of Longest Increasing Subsequences (LIS) using Segment Tree

#include using namespace std;  #define M 100000  vector tree(4 * M + 1);  void update_tree(int start, int end,                 int update_idx, int length_t,                 int count_c, int idx){            if (start == end        && start == update_idx) {        tree[idx].first            = max(tree[idx].first, length_t);        tree[idx].second = count_c;        return;    }          if (update_idx < start        || end < update_idx) {        return;    }          int mid = (start + end) / 2;      update_tree(start, mid, update_idx,                length_t, count_c,                2 * idx);    update_tree(mid + 1, end, update_idx,                length_t, […]

Continue Reading

Minimize count of steps to make all Matrix elements as 0 by replacing neighbours of K with 0

#include using namespace std;  void traverse(int M, int N,              vector& matrix,              int row, int col){          if (row >= 0 && row < M        && col >= 0 && col < N) {        if (matrix[row][col] == 0) {            return;        }                          matrix[row][col] = 0;                  traverse(M, N, matrix, row, col - 1);                  traverse(M, N, matrix, row, col + 1);                  traverse(M, N, matrix, row - 1, col);                  traverse(M, N, matrix, row + […]

Continue Reading

Maximum length of consecutive 1s or 0s after flipping at most K characters

#include using namespace std;  int maxLength(string str, int n,              char c, int k){        int ans = -1;          int cnt = 0;          int left = 0;      for (int right = 0; right < n; right++) {          if (str[right] == c) {            cnt++;        }                  while (cnt > k) {            if (str[left] == c) {                cnt–;            }                                      left++;        }                          ans = max(ans, right – left + 1);    }      return ans;}  int maxConsecutiveSegment(string S, int K){    int N = […]

Continue Reading

Karatsuba Algorithm for fast Multiplication of Large Decimal Numbers represented as Strings

  #include using namespace std;  string findSum(string str1, string str2){            if (str1.length() > str2.length())        swap(str1, str2);          string str = “”;          int n1 = str1.length();    int n2 = str2.length();          reverse(str1.begin(), str1.end());    reverse(str2.begin(), str2.end());      int carry = 0;    for (int i = 0; i < n1; i++) {                          int sum            = ((str1[i] - '0')               + (str2[i] - '0')               + carry);        str.push_back(sum % 10 + '0');                  carry = sum / 10;    }          for (int i = n1; […]

Continue Reading