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.
publicstaticintintroTutorial(intV,List<Integer>arr){int[]hash=newint[2001];for(inti=0;i<arr.size();i++)hash[arr.get(i)+1000]=i;// 1000 is because we have negative numbers too... :)returnhash[V+1000];}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Intro to Tutorial Challenges
You are viewing a single comment's thread. Return to all comments →
A different approach using hash table