Skip to content
Programmingoneonone
Programmingoneonone
  • Engineering Subjects
    • Internet of Things (IoT)
    • Digital Communication
    • Human Values
  • Programming Tutorials
    • C Programming
    • Data structures and Algorithms
    • 100+ Java Programs
    • 100+ C Programs
    • 100+ C++ Programs
  • Solutions
    • HackerRank
      • Algorithms Solutions
      • C solutions
      • C++ solutions
      • Java solutions
      • Python solutions
    • Leetcode Solutions
    • HackerEarth Solutions
  • Work with US
Programmingoneonone
Programmingoneonone

HackerEarth Killjee and superdromes (Lowe) problem solution

YASH PAL, 31 July 202413 February 2026
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 HackerEarth HackerEarth

Post navigation

Previous post
Next post

Leave a Reply

Your email address will not be published. Required fields are marked *

Programmingoneonone

We at Programmingoneonone, also known as Programming101 is a learning hub of programming and other related stuff. We provide free learning tutorials/articles related to programming and other technical stuff to people who are eager to learn about it.

Pages

  • About US
  • Contact US
  • Privacy Policy

Practice

  • Java
  • C++
  • C

Follow US

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