Skip to content
Programming101
Programming101

Learn everything about programming

  • Home
  • CS Subjects
    • IoT – Internet of Things
    • Digital Communication
    • Human Values
  • 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
Programming101
Programming101

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

Post navigation

Previous post
Next post
  • HackerRank Separate the Numbers solution
  • How AI Is Revolutionizing Personalized Learning in Schools
  • GTA 5 is the Game of the Year for 2024 and 2025
  • Hackerrank Day 5 loops 30 days of code solution
  • Hackerrank Day 6 Lets Review 30 days of code solution
How to download udemy paid courses for free

Pages

  • About US
  • Contact US
  • Privacy Policy

Programing Practice

  • C Programs
  • java Programs

HackerRank Solutions

  • C
  • C++
  • Java
  • Python
  • Algorithm

Other

  • Leetcode Solutions
  • Interview Preparation

Programming Tutorials

  • DSA
  • C

CS Subjects

  • Digital Communication
  • Human Values
  • Internet Of Things
©2025 Programming101 | WordPress Theme by SuperbThemes