Skip to content
Programmingoneonone
Programmingoneonone

Learn everything about programming

  • Home
  • CS Subjects
    • Internet of Things (IoT)
    • Digital Communication
    • Human Values
    • Cybersecurity
  • Programming Tutorials
    • C Programming
    • Data structures and Algorithms
    • 100+ Java Programs
    • 100+ C Programs
  • HackerRank Solutions
    • HackerRank Algorithms Solutions
    • HackerRank C problems solutions
    • HackerRank C++ problems solutions
    • HackerRank Java problems solutions
    • HackerRank Python problems solutions
Programmingoneonone
Programmingoneonone

Learn everything about programming

HackerEarth Killjee and superdromes (Lowe) problem solution

YASH PAL, 31 July 2024
In this HackerEarth Killjee and superdromes (Lowe) problem solution Killjee has recently read about superdromes. Superdromes are those numbers that are palindromic in both binary and decimal representation.
The number represented in binary representation will be up to its most significant bit which is 1. For example, 2 will be represented as {10}, 6 will be represented as {110} and so on. Now killjee ask you to find the number of Superdromes less than or equal to n for given n.
HackerEarth Killjee and superdromes (Lowe) problem solution

HackerEarth Killjee and superdromes (Lowe) problem solution.

#include<bits/stdc++.h>
using namespace std;
int ar[1000000]={0};
int arcount=0;
int solve (int n)
{

if(arcount<n)

{

int total=ar[arcount];

for(int i=arcount+1;i<=n;i=i+2)

{

int temp=i;
int super=1;
int decimal[100001];
int count=-1;
while(temp>0)

{

count++;

decimal[count]=temp%10;

temp=temp/10;

}

for(int j=0;j<=count/2;j++)

{

if(decimal[j]!=decimal[count-j])

{

super=0;

break;

}

}

if(super)

{

int binary[20];

temp = i;

count=-1;

while(temp>0)

{

count++;

binary[count]=temp%2;

temp=temp/2;

}

for(int j=0;j<=count/2;j++)

{

if(binary[j]!=binary[count-j])

{

super=0;

break;

}
}
}

if(super)
{

total++;
}

arcount++;

ar[arcount]=total;

arcount++;

ar[arcount]=total;

}

return total;

}

else

{

return ar[n];

}
}
int main()

{

int T;

cin >> T;

for(int t_i=0; t_i<T; t_i++)

{

int n;

cin >> n;

int out_;

out_ = solve(n);

cout << out_;

cout << "n";

}

}
coding problems solutions

Post navigation

Previous post
Next post

Are you a student and stuck with your career or worried about real-time things, and don't know how to manage your learning phase? Which profession to choose? and how to learn new things according to your goal, and land a dream job. Then this might help to you.

Hi My name is YASH PAL, founder of this Blog and a Senior Software engineer with 5+ years of Industry experience. I personally helped 40+ students to make a clear goal in their professional lives. Just book a one-on-one personal call with me for 30 minutes for 300 Rupees. Ask all your doubts and questions related to your career to set a clear roadmap for your professional life.

Book session - https://wa.me/qr/JQ2LAS7AASE2M1

Pages

  • About US
  • Contact US
  • Privacy Policy

Follow US

  • YouTube
  • LinkedIn
  • Facebook
  • Pinterest
  • Instagram
©2026 Programmingoneonone | WordPress Theme by SuperbThemes