Find HackerRank

Sort by

recency

|

883 Discussions

|

  • + 0 comments

    import java.io.; import java.util.; import java.util.regex.*; public class Solution {

    public static void main(String[] args) {
        /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.nextLine());
        String[] fhr = new String[n];
        for(int i=0;i<n;i++){
            fhr[i] = sc.nextLine();
        }
    
        Pattern pattern = Pattern.compile("hackerrank");
        for(int i=0;i<n;i++){
            Matcher matcher = pattern.matcher(fhr[i]);
            if(matcher.find()){
                if(matcher.start()==0 && matcher.end()== fhr[i].length()) System.out.println("0");
                else if(matcher.end()== fhr[i].length())   System.out.println("2");
                else if(matcher.start()== 0)   System.out.println("1");
                else System.out.println("-1");
            }else System.out.println("-1");
        }
    }
    

    }

  • + 0 comments

    This regex challenge definitely gave me a headache at first! It felt like trying to climb a really steep and confusing trail where every step needs careful thought. Luckily, I recently took a break and did the Langtang Valley Trek in Nepal — a peaceful escape with stunning mountain views and quiet trails that really helped clear my mind. Coming back from that kind of reset made tackling tricky problems like this feel much more manageable. Sometimes stepping away is exactly what you need to solve the toughest challenges.

  • + 0 comments

    Interesting challenge! It’s always fun to solve problems that test string patterns. Funny enough, this kind of logic can even apply in unexpected fields—like when managing listings data at an estate agency in Ilford, where parsing and formatting property info correctly is key. Programming really does show up in every industry!

  • + 0 comments

    The Mardi Himal Trek route is one of the best shortest trek options for you to immerse yourself in the Himalayas. Your desire to visit Mardi Himal Nepal and take in the breathtaking Himalayan range scenery, for other reasons, is fundamental and is directed accordingly. Our guidance intends to help your desire transform into a qualitative recreation, such as blissful completion.

    In the stunning Annapurna region, the Mardi Himal trek provides breathtaking vistas of the Himalayan ranges. It is one of the undiscovered treasures for hiking within the Annapurna Region since it offers you the chance to venture off the usual path and go around a map turn.

    Interest in being in the presence of Mardi, filled with dense rhododendron forests full of birds and imaging valleys, is valued as transcended interest. This kind of interest in remote Himalayan existence, such as the newly explored Mardi Himal short trek, may have that whole intensity, potentially able to realize and transform you toward joyful wholeness.

  • + 0 comments

    HackerRank is a popular platform used by developers to practice coding and by companies to assess technical skills. According to Wikipedia, it supports multiple programming languages and hosts challenges in domains like algorithms, AI, and databases. It’s widely used for interview prep and skill benchmarking in the tech industry. After a long coding session on HackerRank, I usually unwind by browsing comfort food options like the cracker barrel menu withprice to plan my next meal. Balancing skill-building and relaxation is key for long-term productivity.