• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

find covering prefix

 
Ranch Hand
Posts: 1402
3
Netbeans IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I am trying to find a covering prefix

my code is:



Thanks
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What do you mean by "adding a new value dynamically"? Do you mean to increase the array's length? If so, then that can't be done. You could use a List<Integer> instead of an int[] - that can be extended dynamically.
 
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Angus Ferguson wrote:I am trying to find a covering prefix...


Well, first: you need to define what a "covering prefix" is (I had to look it up); because it will be different for an int[] than it is for a String[] (at least the way of calculating it will be very different). Furthermore, it's quite possible that there are types for which it is simply not applicable ('can't think of one, based on what I've read; but it's worth thinking about).

However, for an int[], it would appear to be a byproduct of the max() function; so you might want to look at Math.max().

Winston
 
reply
    Bookmark Topic Watch Topic
  • New Topic