๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
9.52K subscribers
5.55K photos
3 videos
95 files
9.64K 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
#include <vector>
using namespace std;

vector<int> solution(vector<int> forest, int bird) {
    vector<int> pos;
    int total_length = 0;
    int direction = 1;
    int n = forest.size();
    while (total_length < 100) {
        if (direction == 1) {
            for (int i = bird + 1; i < n; i++) {
                if (forest[i] > 0) {
                    pos.push_back(i);
                    total_length += forest[i];
                    forest[i] = 0;
                    break;
                }
            }
        } else {
            for (int i = bird - 1; i >= 0; i--) {
                if (forest[i] > 0) {
                    pos.push_back(i);
                    total_length += forest[i];
                    forest[i] = 0;
                    break;
                }
            }
        }
        direction *= -1;
    }
    return pos;
}


Visa โœ