SlideShare una empresa de Scribd logo
1 de 1
Descargar para leer sin conexión
[C#] Q. You want to convert the natural number x to y.
The following operations are available:
Given the natural numbers x, y, and n as parameters,
complete the solution function to return the minimum number of operations required to convert x to
y.
If you can't make x into y at this point, please return -1.
Restrictions
Input/Output Example
Input/Output Example Description
Input/Output Example #1
Multiply x by 2 twice to get 40 and this is the minimum number of times.
Input/Output Example #2
x plus n = 30 times to get 40 and this is the minimum number of times.
Input/Output Example #3
Returns -1 because x cannot be converted to y.
[Write only a solution]
using System;
public class Solution {
public int solution(int x, int y, int n) {
int answer = 0;
return answer;
}
}
Add n to x
Multiply x by 2.
Multiply x by 3.

Más contenido relacionado

Similar a C Q You want to convert the natural number x to y The f.pdf

Lesson 3a_operations of Functions.pptx
Lesson 3a_operations of Functions.pptxLesson 3a_operations of Functions.pptx
Lesson 3a_operations of Functions.pptxAlfredoLabador
 
AMS_502_13, 14,15,16 (1).pptx
AMS_502_13, 14,15,16 (1).pptxAMS_502_13, 14,15,16 (1).pptx
AMS_502_13, 14,15,16 (1).pptxbhavypatel2228
 
Data Structures- Part5 recursion
Data Structures- Part5 recursionData Structures- Part5 recursion
Data Structures- Part5 recursionAbdullah Al-hazmy
 
01 - DAA - PPT.pptx
01 - DAA - PPT.pptx01 - DAA - PPT.pptx
01 - DAA - PPT.pptxKokilaK25
 
BOOTH Algorithm for Multiplication
BOOTH Algorithm for MultiplicationBOOTH Algorithm for Multiplication
BOOTH Algorithm for MultiplicationSnehalataAgasti
 
Admission in india 2015
Admission in india 2015Admission in india 2015
Admission in india 2015Edhole.com
 
1 chapter1 introduction
1 chapter1 introduction1 chapter1 introduction
1 chapter1 introductionSSE_AndyLi
 
chapter1.pdf ......................................
chapter1.pdf ......................................chapter1.pdf ......................................
chapter1.pdf ......................................nourhandardeer3
 
Insider mathematical
Insider   mathematicalInsider   mathematical
Insider mathematicalAditi Saxena
 

Similar a C Q You want to convert the natural number x to y The f.pdf (15)

Unit 2 in daa
Unit 2 in daaUnit 2 in daa
Unit 2 in daa
 
Divide and Conquer
Divide and ConquerDivide and Conquer
Divide and Conquer
 
Lesson 3a_operations of Functions.pptx
Lesson 3a_operations of Functions.pptxLesson 3a_operations of Functions.pptx
Lesson 3a_operations of Functions.pptx
 
AMS_502_13, 14,15,16 (1).pptx
AMS_502_13, 14,15,16 (1).pptxAMS_502_13, 14,15,16 (1).pptx
AMS_502_13, 14,15,16 (1).pptx
 
Data Structures- Part5 recursion
Data Structures- Part5 recursionData Structures- Part5 recursion
Data Structures- Part5 recursion
 
Advance algebra
Advance algebraAdvance algebra
Advance algebra
 
01 - DAA - PPT.pptx
01 - DAA - PPT.pptx01 - DAA - PPT.pptx
01 - DAA - PPT.pptx
 
Regression
RegressionRegression
Regression
 
BOOTH Algorithm for Multiplication
BOOTH Algorithm for MultiplicationBOOTH Algorithm for Multiplication
BOOTH Algorithm for Multiplication
 
Admission in india 2015
Admission in india 2015Admission in india 2015
Admission in india 2015
 
RecursionWeek8.ppt
RecursionWeek8.pptRecursionWeek8.ppt
RecursionWeek8.ppt
 
1 chapter1 introduction
1 chapter1 introduction1 chapter1 introduction
1 chapter1 introduction
 
Advance algebra
Advance algebraAdvance algebra
Advance algebra
 
chapter1.pdf ......................................
chapter1.pdf ......................................chapter1.pdf ......................................
chapter1.pdf ......................................
 
Insider mathematical
Insider   mathematicalInsider   mathematical
Insider mathematical
 

Más de jaipur2

Business inventories increased 19 billion in the second qua.pdf
Business inventories increased 19 billion in the second qua.pdfBusiness inventories increased 19 billion in the second qua.pdf
Business inventories increased 19 billion in the second qua.pdfjaipur2
 
Bu yaz kamyonu farkl yerel topluluk etkinliklerine gtryor.pdf
Bu yaz kamyonu farkl yerel topluluk etkinliklerine gtryor.pdfBu yaz kamyonu farkl yerel topluluk etkinliklerine gtryor.pdf
Bu yaz kamyonu farkl yerel topluluk etkinliklerine gtryor.pdfjaipur2
 
BU Contractors received a contract to construct an office bu.pdf
BU Contractors received a contract to construct an office bu.pdfBU Contractors received a contract to construct an office bu.pdf
BU Contractors received a contract to construct an office bu.pdfjaipur2
 
Bu senaryo bir geici zm en iyi ekilde aklar Etkili.pdf
Bu senaryo bir geici zm en iyi ekilde aklar   Etkili.pdfBu senaryo bir geici zm en iyi ekilde aklar   Etkili.pdf
Bu senaryo bir geici zm en iyi ekilde aklar Etkili.pdfjaipur2
 
Bu durum iin tam binom olaslk dalmn sadaki bir tabloda olut.pdf
Bu durum iin tam binom olaslk dalmn sadaki bir tabloda olut.pdfBu durum iin tam binom olaslk dalmn sadaki bir tabloda olut.pdf
Bu durum iin tam binom olaslk dalmn sadaki bir tabloda olut.pdfjaipur2
 
Bu derste T hcreleri iin merkezi ve evresel tolerans mek.pdf
Bu derste T hcreleri iin merkezi ve evresel tolerans mek.pdfBu derste T hcreleri iin merkezi ve evresel tolerans mek.pdf
Bu derste T hcreleri iin merkezi ve evresel tolerans mek.pdfjaipur2
 
Bullseye Corp is a private company in the state of Illinois .pdf
Bullseye Corp is a private company in the state of Illinois .pdfBullseye Corp is a private company in the state of Illinois .pdf
Bullseye Corp is a private company in the state of Illinois .pdfjaipur2
 
Bulging and herniated discs can cause major problems when th.pdf
Bulging and herniated discs can cause major problems when th.pdfBulging and herniated discs can cause major problems when th.pdf
Bulging and herniated discs can cause major problems when th.pdfjaipur2
 
Bullying according to noted expert Dan Olweus poisons t.pdf
Bullying according to noted expert Dan Olweus poisons t.pdfBullying according to noted expert Dan Olweus poisons t.pdf
Bullying according to noted expert Dan Olweus poisons t.pdfjaipur2
 
C++ Please I am posting the fifth time and hoping to get th.pdf
C++ Please I am posting the fifth time and hoping to get th.pdfC++ Please I am posting the fifth time and hoping to get th.pdf
C++ Please I am posting the fifth time and hoping to get th.pdfjaipur2
 
C++ only plz Write a function that takes two arguments and .pdf
C++ only  plz Write a function that takes two arguments and .pdfC++ only  plz Write a function that takes two arguments and .pdf
C++ only plz Write a function that takes two arguments and .pdfjaipur2
 
C++ only 319 LAB Exact change Write a program with total c.pdf
C++ only 319 LAB Exact change Write a program with total c.pdfC++ only 319 LAB Exact change Write a program with total c.pdf
C++ only 319 LAB Exact change Write a program with total c.pdfjaipur2
 
C++ Help with the section for doEditTweet only Program .pdf
C++ Help with the section for doEditTweet only  Program .pdfC++ Help with the section for doEditTweet only  Program .pdf
C++ Help with the section for doEditTweet only Program .pdfjaipur2
 
C++ is a highlevel programming language that consists of v.pdf
C++ is a highlevel programming language that consists of v.pdfC++ is a highlevel programming language that consists of v.pdf
C++ is a highlevel programming language that consists of v.pdfjaipur2
 
C++ Help with the section for getNextId only Program to.pdf
C++ Help with the section for getNextId only  Program to.pdfC++ Help with the section for getNextId only  Program to.pdf
C++ Help with the section for getNextId only Program to.pdfjaipur2
 
C++ Help with the section for doEditTweet only NOT using s.pdf
C++ Help with the section for doEditTweet only NOT using s.pdfC++ Help with the section for doEditTweet only NOT using s.pdf
C++ Help with the section for doEditTweet only NOT using s.pdfjaipur2
 
C++ Programming Exercise 9 from Chapter 16 Upload your so.pdf
C++  Programming Exercise 9 from Chapter 16 Upload your so.pdfC++  Programming Exercise 9 from Chapter 16 Upload your so.pdf
C++ Programming Exercise 9 from Chapter 16 Upload your so.pdfjaipur2
 
BU RESTORAN KURTARILABLR M Juan ve Bonita Gonzales Ohio .pdf
BU RESTORAN KURTARILABLR M  Juan ve Bonita Gonzales Ohio .pdfBU RESTORAN KURTARILABLR M  Juan ve Bonita Gonzales Ohio .pdf
BU RESTORAN KURTARILABLR M Juan ve Bonita Gonzales Ohio .pdfjaipur2
 
C Sao Paulodaki Lumiar okulunda snf ev devi veya oyun zam.pdf
C Sao Paulodaki Lumiar okulunda snf ev devi veya oyun zam.pdfC Sao Paulodaki Lumiar okulunda snf ev devi veya oyun zam.pdf
C Sao Paulodaki Lumiar okulunda snf ev devi veya oyun zam.pdfjaipur2
 
Bu eitim modlnde sunulan biyolojik tehlike tanmndaki gve.pdf
Bu eitim modlnde sunulan biyolojik tehlike tanmndaki gve.pdfBu eitim modlnde sunulan biyolojik tehlike tanmndaki gve.pdf
Bu eitim modlnde sunulan biyolojik tehlike tanmndaki gve.pdfjaipur2
 

Más de jaipur2 (20)

Business inventories increased 19 billion in the second qua.pdf
Business inventories increased 19 billion in the second qua.pdfBusiness inventories increased 19 billion in the second qua.pdf
Business inventories increased 19 billion in the second qua.pdf
 
Bu yaz kamyonu farkl yerel topluluk etkinliklerine gtryor.pdf
Bu yaz kamyonu farkl yerel topluluk etkinliklerine gtryor.pdfBu yaz kamyonu farkl yerel topluluk etkinliklerine gtryor.pdf
Bu yaz kamyonu farkl yerel topluluk etkinliklerine gtryor.pdf
 
BU Contractors received a contract to construct an office bu.pdf
BU Contractors received a contract to construct an office bu.pdfBU Contractors received a contract to construct an office bu.pdf
BU Contractors received a contract to construct an office bu.pdf
 
Bu senaryo bir geici zm en iyi ekilde aklar Etkili.pdf
Bu senaryo bir geici zm en iyi ekilde aklar   Etkili.pdfBu senaryo bir geici zm en iyi ekilde aklar   Etkili.pdf
Bu senaryo bir geici zm en iyi ekilde aklar Etkili.pdf
 
Bu durum iin tam binom olaslk dalmn sadaki bir tabloda olut.pdf
Bu durum iin tam binom olaslk dalmn sadaki bir tabloda olut.pdfBu durum iin tam binom olaslk dalmn sadaki bir tabloda olut.pdf
Bu durum iin tam binom olaslk dalmn sadaki bir tabloda olut.pdf
 
Bu derste T hcreleri iin merkezi ve evresel tolerans mek.pdf
Bu derste T hcreleri iin merkezi ve evresel tolerans mek.pdfBu derste T hcreleri iin merkezi ve evresel tolerans mek.pdf
Bu derste T hcreleri iin merkezi ve evresel tolerans mek.pdf
 
Bullseye Corp is a private company in the state of Illinois .pdf
Bullseye Corp is a private company in the state of Illinois .pdfBullseye Corp is a private company in the state of Illinois .pdf
Bullseye Corp is a private company in the state of Illinois .pdf
 
Bulging and herniated discs can cause major problems when th.pdf
Bulging and herniated discs can cause major problems when th.pdfBulging and herniated discs can cause major problems when th.pdf
Bulging and herniated discs can cause major problems when th.pdf
 
Bullying according to noted expert Dan Olweus poisons t.pdf
Bullying according to noted expert Dan Olweus poisons t.pdfBullying according to noted expert Dan Olweus poisons t.pdf
Bullying according to noted expert Dan Olweus poisons t.pdf
 
C++ Please I am posting the fifth time and hoping to get th.pdf
C++ Please I am posting the fifth time and hoping to get th.pdfC++ Please I am posting the fifth time and hoping to get th.pdf
C++ Please I am posting the fifth time and hoping to get th.pdf
 
C++ only plz Write a function that takes two arguments and .pdf
C++ only  plz Write a function that takes two arguments and .pdfC++ only  plz Write a function that takes two arguments and .pdf
C++ only plz Write a function that takes two arguments and .pdf
 
C++ only 319 LAB Exact change Write a program with total c.pdf
C++ only 319 LAB Exact change Write a program with total c.pdfC++ only 319 LAB Exact change Write a program with total c.pdf
C++ only 319 LAB Exact change Write a program with total c.pdf
 
C++ Help with the section for doEditTweet only Program .pdf
C++ Help with the section for doEditTweet only  Program .pdfC++ Help with the section for doEditTweet only  Program .pdf
C++ Help with the section for doEditTweet only Program .pdf
 
C++ is a highlevel programming language that consists of v.pdf
C++ is a highlevel programming language that consists of v.pdfC++ is a highlevel programming language that consists of v.pdf
C++ is a highlevel programming language that consists of v.pdf
 
C++ Help with the section for getNextId only Program to.pdf
C++ Help with the section for getNextId only  Program to.pdfC++ Help with the section for getNextId only  Program to.pdf
C++ Help with the section for getNextId only Program to.pdf
 
C++ Help with the section for doEditTweet only NOT using s.pdf
C++ Help with the section for doEditTweet only NOT using s.pdfC++ Help with the section for doEditTweet only NOT using s.pdf
C++ Help with the section for doEditTweet only NOT using s.pdf
 
C++ Programming Exercise 9 from Chapter 16 Upload your so.pdf
C++  Programming Exercise 9 from Chapter 16 Upload your so.pdfC++  Programming Exercise 9 from Chapter 16 Upload your so.pdf
C++ Programming Exercise 9 from Chapter 16 Upload your so.pdf
 
BU RESTORAN KURTARILABLR M Juan ve Bonita Gonzales Ohio .pdf
BU RESTORAN KURTARILABLR M  Juan ve Bonita Gonzales Ohio .pdfBU RESTORAN KURTARILABLR M  Juan ve Bonita Gonzales Ohio .pdf
BU RESTORAN KURTARILABLR M Juan ve Bonita Gonzales Ohio .pdf
 
C Sao Paulodaki Lumiar okulunda snf ev devi veya oyun zam.pdf
C Sao Paulodaki Lumiar okulunda snf ev devi veya oyun zam.pdfC Sao Paulodaki Lumiar okulunda snf ev devi veya oyun zam.pdf
C Sao Paulodaki Lumiar okulunda snf ev devi veya oyun zam.pdf
 
Bu eitim modlnde sunulan biyolojik tehlike tanmndaki gve.pdf
Bu eitim modlnde sunulan biyolojik tehlike tanmndaki gve.pdfBu eitim modlnde sunulan biyolojik tehlike tanmndaki gve.pdf
Bu eitim modlnde sunulan biyolojik tehlike tanmndaki gve.pdf
 

Último

On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesEnergy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesShubhangi Sonawane
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Role Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptxRole Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptxNikitaBankoti2
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin ClassesCeline George
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701bronxfugly43
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docxPoojaSen20
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docxPoojaSen20
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 

Último (20)

On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesEnergy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Role Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptxRole Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptx
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 

C Q You want to convert the natural number x to y The f.pdf

  • 1. [C#] Q. You want to convert the natural number x to y. The following operations are available: Given the natural numbers x, y, and n as parameters, complete the solution function to return the minimum number of operations required to convert x to y. If you can't make x into y at this point, please return -1. Restrictions Input/Output Example Input/Output Example Description Input/Output Example #1 Multiply x by 2 twice to get 40 and this is the minimum number of times. Input/Output Example #2 x plus n = 30 times to get 40 and this is the minimum number of times. Input/Output Example #3 Returns -1 because x cannot be converted to y. [Write only a solution] using System; public class Solution { public int solution(int x, int y, int n) { int answer = 0; return answer; } } Add n to x Multiply x by 2. Multiply x by 3.