Intro to Tutorial Challenges - HackerRank || HackerRank Intro to Tutorial Challenges Solution

Problem Name: Intro to Tutorial Challenges
Judge: HackerRank



HackerRank Intro to Tutorial Challenges Solution in C

#include <stdio.h>

int main()
{
    int V, n;
    scanf("%d %d", &V, &n);
    int arr[n];

    for (int i = 0; i < n; i++)
    {
        scanf("%d", &arr[i]);
    }

    for (int i = 0; i < n; i++)
    {
        if (arr[i] == V)
        {
            printf("%d\n", i);
        }
    }

    return 0;
}


HackerRank Intro to Tutorial Challenges Solution in C++/Cpp

#include <bits/stdc++.h>

using namespace std;

int main()
{
    int V, n;
    cin >> V >> n;
    int arr[n];

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

    for (int i = 0; i < n; i++)
    {
        if (arr[i] == V)
        {
            cout << i << endl;
        }
    }

    return 0;
}


HackerRank Intro to Tutorial Challenges Solution in Java

import java.util.Scanner;

public class Intro_to_Tutorial_Challenges {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int V = input.nextInt();
        int n = input.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = input.nextInt();
        }
        for (int i = 0; i < n; i++) {
            if (arr[i] == V) {
                System.out.println(i);
            }
        }
    }
}





Next Post Previous Post
No Comment
Add Comment
comment url