๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
9.52K subscribers
5.56K photos
3 videos
95 files
9.7K links
๐ŸšฉMain Group - @SuperExams
๐Ÿ“Job Updates - @FresherEarth

๐Ÿ”ฐAuthentic Coding Solutions(with Outputs)
โš ๏ธDaily Job Updates
โš ๏ธHackathon Updates & Solutions

Buy ads: https://telega.io/c/cs_algo
Download Telegram
๐Ÿš€ Do you want to launch a career in Data Analytics in a top MNC right after college?๐ŸŽฏ

Join our webinar to understand the Data Analytics domain, job opportunities and the skills needed as a recent graduate to crack a role from a highly experienced speaker.

๐Ÿ“… Save the date: Today at 04:00 PM IST ๐Ÿ“…โฐ

๐ŸŽŸ๏ธ Register for FREE (Limited seats available): https://bit.ly/3M6UA4l ๐Ÿ†“๐ŸŽŸ๏ธ
๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
Photo
#include <bits/stdc++.h>
using namespace std;

int solve(int arr[], int n){

  int pos[n], p = 0;

  for(int i=0;i<n;i++){
    if(arr[i] == 1){
      pos[p] = i + 1;
      p++;
    }
  }

  if(p == 0) return 0;

  int res = 1;
  for(int i=0;i<p-1;i++){
    res *= pos[i+1]-pos[i];
  }
  return res;
}

int main(){
  int n;
    cin >> n;

    int arr[n];
   
    for(int i=0;i<n;i++){
        cin>>arr[i];
    }
  cout<<solve(arr, n);
  return 0;
}

One Block โœ…
vector<int> counts(const vector<int>& ListA, const vector<int>& ListB) {
    int m = ListA.size();
    int n = ListB.size();
    vector<int> ans;
    vector<int> sortedListA = ListA;
    sort(sortedListA.begin(), sortedListA.end());
    for (int i = 0; i < n; i++) {
        auto it = upper_bound(sortedListA.begin(), sortedListA.end(), ListB[i]);
        int cnt = it - sortedListA.begin();
        ans.push_back(cnt);
    }

    return ans;
}

Twillo โœ…
๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
Photo
#include<bits/stdc++.h>

using namespace std;

int main() {
    int N, X;
    cin >> N >> X;
    vector<vector<int>> A(N, vector<int>(N));

    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            cin >> A[i][j];
        }
    }

    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            int val = A[i][j];
            int replacement = (val / X) * X;
            A[i][j] = (replacement > 0) ? replacement : 0;
        }
    }

    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            cout << A[i][j] << " ";
        }
        cout << endl;
    }

    return 0;
}