Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7403961
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:11:12+00:00 2026-05-29T05:11:12+00:00

Given a positive integer N, we are allowed to apply any of the following

  • 0

Given a positive integer N, we are allowed to apply any of the following operations as many times as we want in any order:

First Operation: Add 1 the Given positive integer N; If N is 7, after that operation N becomes 8. If N is 999, after that operation it becomes 1000.

Second operation: choose any occurrence of any digit and replace it by another digit. (475->479, 101 -> 111, 299 -> 199 and so on)

Third operation: add any non-zero digit to the left of the decimal representation of N: 47 -> 247, 9999 -> 49999, 2474 -> 72474 and so on).

Find the minimum number of operations that is needed for changing N to the lucky number.(Lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.)

EXAMPLES:

N=25, answer=2

N=46, answer=1

N=99, answer=2

I found this problem while I was trying various problems on LUCKY NUMBER..
I am stuck at this problem…
Please help..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T05:11:12+00:00Added an answer on May 29, 2026 at 5:11 am

    The “add 1 to the number” and “add any non-zero leading digit to the number” are red herrings.

    The minimum number of operations is one per digit in N which is non-lucky. You just change each of the non-4, non-7 digits to either 4 or 7.

    Adding a leading digit will never help you because there’s no need to make the number longer. Adding 1 seems like it could help, but it will only do two things: either it does not carry (when you add to a digit less than 9), in which case a straight replacement can do the same thing, or it carries (when you add to a 9), in which case it’s just created one or more non-lucky zeros you’re now going to have to “fix” with digit replacement.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given a positive integer n, I want to generate all possible n bit combinations
I want to calculate the result, given any exponent (negative or positive) and a
Given an array of positive integer, we need to exchange each element with first
You are given a positive integer A. The goal is to construct the shortest
Given k positive integer numbers a 1 < a 2 < a 3 <
Let A be an array of n positive integers, and k a given integer.
I had this question: Given an unsorted array of positive integers and an integer
I want to write some code which takes any positive, even number (greater than
Given a positive integer sequence of numbers in an array with common difference 2
Given a positive integer X , how can one partition it into N parts,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.