• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Finding the number is having pairs and also number is in sequence/consecutive

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

Can anyone help me to write a program to find out the given number is having pairs and also number is in sequence?
example: 11223344 is having pair 11 22 33 44 and also number is in sequence.

Please help
 
lowercase baba
Posts: 12751
51
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HELP you? of course - we love doing that.

but nobody here is going to do it FOR you.

so..show us what you've got. Where are you stuck? Ask specific questions and you will get specific feedback. Ask general questions, and you'll get general feedback.
 
sandeshas naik
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


The above code will give the count for each number but it will fails when we try for 12332144 - (Its not a sequence). Please help.
 
Marshal
Posts: 64690
225
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am afraid there is a piece of hardware which is obstructing your progress. It is black and long and thin and it runs from the back of your computer to the wall. Remove it.

Get a sheet of paper a pencil and an eraser (the latter should be large, because you will use it a lot ‍). Write down in words of one syllable how you intend to do your exercise. Then you will be able to see how to convert it to code.
Two things to remind yourself of:-
  • 1: You are not dealing with a number, but a String. You can prove you are not dealing with numbers by converting your input to hexadecimal, and it will not work.
  • 2: You can do arithmetic with chars. They are not letters, but numbers hidden behind characters.
  •  
    It is sorta covered in the JavaRanch Style Guide.
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!