We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • Hackerrank Home
  • Prepare
    NEW
  • Certify
  • Compete
  • Career Fair
  • Hiring developers?
  1. Prepare
  2. Algorithms
  3. Sorting
  4. Intro to Tutorial Challenges
  5. Discussions

Intro to Tutorial Challenges

Problem
Submissions
Leaderboard
Discussions

Sort 337 Discussions, By:

votes

Please Login in order to post a comment

  • surya_227
    7 years ago+ 11 comments

    Array is not required , this will do it for(i=0;i < no;i++) {
    scanf("%d",&input); if(input == key) printf("%d",i); }

    37|
    Permalink
    View more Comments..
  • gunacode
    3 years ago+ 0 comments

    Its a very basic question and I dont know why they have given 30 points. only 3 lines of code is enough to solve

    11|
    Permalink
  • marinskiy
    3 years ago+ 3 comments

    Here is Python 3 solution from my HackerrankPractice repository:

    v = int(input())
    n = int(input())
    arr = list(map(int, input().split()))
    i = 0
    while arr[i] != v:
        i += 1
    print(i)
    

    Feel free to ask if you have any questions :)

    5|
    Permalink
  • the_happy_hacker
    3 years ago+ 1 comment

    My solution in Python3:

    def introTutorial(V, arr):
      return arr.index(V)
    
    4|
    Permalink
  • edvindzidic2000
    3 years ago+ 1 comment

    Javascript solution:

    return arr.indexOf(V);
    
    4|
    Permalink
Load more conversations

Need Help?


View top submissions
  • Contest Calendar
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy
  • Request a Feature