Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Core Coding: Prime and Palindrome

EasyPython00:00
Practice interviewer
In session
5 left
00:00

Your question is Core Coding: Prime and Palindrome. Start with the requirements on the right.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.

Problem

  1. Program to check prime number. 2. Program to check palindrome.

Implement check_prime_and_palindrome(number) for a non-negative integer. Return a two-element list: [is_prime, is_palindrome]. Treat numbers less than 2 as non-prime, and check palindromes using the decimal representation of the number.

Example: number = 131 returns [True, True].

Constraints

  • 0 <= number <= 10^12
  • number is an integer
  • Return exactly two boolean values in the order [is_prime, is_palindrome]

Function Signature

def check_prime_and_palindrome(number):
Your solutionPython 3
You need to log in / sign up to run or submit.
Run your code to see test output