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. All Contests
  2. ProjectEuler+
  3. Project Euler #206: Concealed Square
  4. Discussions

Project Euler #206: Concealed Square

Problem
Submissions
Leaderboard
Discussions

Sort 41 Discussions, By:

votes

Please Login in order to post a comment

  • jamesbigmac
    4 years ago+ 0 comments

    I submitted my code knowing that it would time out. Besides throwing zeroes in between the given digits and starting at the ceiling of the square root of that number, I have no idea how to cut the problem down. My code is good up to 10 given digits but it will time out with most cases above that. Any hints as to how you can break the problem down further?

    Edit: You can also disregard roots based on the last digit of the given digits. For example, last digit being 1 can only come from 1 or 9, last digit 4 can only come from 8 or 2.

    2|
    Permalink
  • Apotheosys
    4 years ago+ 1 comment

    Finally did it. Wow.

    That was a super fun (!!) challenge, although a tough one to crack. I felt you really had to get a very good understanding of what happens when squaring numbers, much more than I was expecting from a challenge that was labeled as easy. Maybe this is more of a medium-difficulty challenge? At least for the cases where n is large and you need to explore the space of potential solutions very economically.

    2|
    Permalink
  • Mr_Shetty
    4 years ago+ 2 comments
    >>> 2153662**2
    4638260010244
    >>> 2222222**2
    4938270617284
    

    I am confused a bit, if the input is

    7
    4 3 2 0 1 2 4
    

    What could be the answer? as 2153662 and 2222222 both satisfies the list(or array)...

    1|
    Permalink
  • Belimitless
    1 year ago+ 0 comments

    Passed only 16 cases...Time limit exceeded :/

    and it is marked as "Easy" ಥ_ಥ

    import itertools
    n = int(input())
    fuc = 0
    s = list(map(int, input().split()))
    flag = 0
    res = [0]*(2*n-1)
    for i in range(0, 2 * n, 2):
        res[i] = s[flag]
        flag = flag+1
    for i in itertools.count(start=10):
        fuc = (i*i)
        square = list(map(int, str(fuc)))
        if (res[::2] == square[::2]):
            print(i)
            break
    
    0|
    Permalink
  • rishabhmaheshwa1
    3 years ago+ 0 comments

    n=int(input()) q=input() q1=q.split(" ") x="" for q2 in q1: x=x+q2 a1=list(x) s="" l=len(a1) for i in range((10(l-1)),(10l)): sq=1 s="" sq1=[] sq=i*i sq1=list(str(sq)) for j in range(0,(len(sq1)),2): s=s+sq1[j] if s == x: print(i) break**

    My solution passed 16 test cases only. Rest all the cases aborted due to timeout. Any suggestions to reduce calculation time. My code is in python.

    0|
    Permalink
Load more conversations

Need Help?


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