HN user

marethyu

31 karma
Posts2
Comments28
View on HN

I attempted the problem myself before reading your solution. My strategy is bit different: for every N>285, I check whether there exists a positive integer solution n to two equations T_N=P_n and T_N=H_n. Using basic algebra and quadratic formula, it boils down to checking whether the quantities 1+12(NN+N) and 1+4(NN+N) are perfect squares. If they are perfect squares, denote their squares by x and y. The next step is to check if 1+x is divisible by 6 and if 1+y is divisible by 4. They are easy using % operator.

    from math import sqrt

    def isPerfectSquare(n):
        sr = int(sqrt(n))
        return sr * sr == n

    for N in range(1, 10000000000):
        foo = 1 + 12*(N*N + N)
        bar = 1 + 4*(N*N + N)
        if isPerfectSquare(foo) and isPerfectSquare(bar):
            x, y = int(sqrt(foo)), int(sqrt(bar))
            if (1+x)%6 == 0 and (1+y)%4 == 0:
                print(f'Candidate found: N={N}, T_N={N*(N+1)/2}')

Should I be willing to relocate to US for FAANG internship or it would be fully remote? If need to relocate, will I be responsible for paying flight tickets and lodging?

Also, what is the best way to get accepted for FAANG interview for someone with no work experience? Submit resume directly to company website? Connect with FAANG recruiters on LinkedIn and direct message them? Maybe try to get some experience in other tech company before applying to FAANG to maximize chances?

I think it depends on how you learn vocabulary. If somebody learns a bunch of vocabulary on context, then he will naturally acquire grammar and pronunciation compared to somebody who learns off context.