Sort by

recency

|

2595 Discussions

|

  • + 0 comments

    Interesting challenge! I found that sorting the array first really helped in simplifying the logic—especially when checking consecutive number differences. For those who enjoy brain teasers like this and want a way to relax afterward, check out PPCine APK. It’s a free streaming app for Android, great for winding down after a coding session.

  • + 0 comments

    Interesting challenge — definitely makes you think about frequency maps and array logic differently. I solved it using a simple count array and looped through to find the max sum of adjacent counts.

    BTW, if anyone here enjoys logical structure and problem-solving outside of pure code, I run a surf blog that breaks down surfboard types and gear the same way we break down code — clearly and with purpose. Feel free to check it out: Surviving Summer

  • + 0 comments
    def pickingNumbers(a):
        a = sorted(a)
        start = a[0]
        length = 0
        longest = 0
        for i in a:
            if (i - start) <= 1:
                length += 1
            else:
                start = i
                length = 1
            longest = max(length, longest)
                
        return longest
    
  • + 0 comments

    Interesting how much strategy goes into something as simple as picking a number. It actually reminds me of a recent experience I had while working on a bathroom remodeling Bellevue project. Just like choosing the right number, selecting the right materials, layout, and fixtures comes down to understanding the purpose and anticipating how it will be used. You’d be surprised how often people overlook the small choices that end up making a big difference—whether in games or in home design.

  • + 0 comments
    function pickingNumbers(a: number[]): number {
        const occur = Array(100).fill(0);
        
        for(let x of a) {
            occur[x]++;
        }
        
        return Math.max(...occur.slice(0, -1).map((o, i) => o + occur[i+1]));
    }