Can anyone help me about deleting the repeats by java??

My subject is to write a static method called deleteRepeats that has a partially filled array of characters as formal parameter and deletes all repeated letters from the array.And when a letter is deleted, the remaining letters are moved one position to fill in the gap.This second formal parameter cannot be changed by a Java method, so have the method return the new value for this parameter. For example;
char a[10];
a[0] = 'a';
a[1] = 'b';
a[2] = 'a';
a[3] = 'c';
int size = 4;
size = deleteRepeats(a, size);
After this code is executed, the value of a[0] is 'a', the value of a[1] is 'b', the value of a[2] is 'c', and the value of size is 3
So I did it like.Is it true?
public class deleteRepeats{
public static int deleteRepeats(char[] a, int size) {
     size=a.length;
     int numberOfRepeats=0;
     for(int i=0; i<size; i++) {
     for(int j=1; i+j<size; j++) {
     if(a==a[i+j]) {
     a[i+j]=a[(i+j)+1];
     size--;
     numberOfRepeats++;
return size;

nclow wrote:
CellAt wrote:
If you think Set is very simple for this question please share with me.I figured this was a homework assignment and you didn't know about collections yet. Why not read the documentation?
[http://java.sun.com/javase/6/docs/api/java/util/Set.html|http://java.sun.com/javase/6/docs/api/java/util/Set.html]
Your existing implementation would work if you would address the bug I pointed out...thanks...

Similar Messages

  • Can anyone help me with getting the best setting for me system

    can anyone help me with getting the best setting for me system on cpufan it says my temp is 38c but on corecentre it says 42c can anyone help get my system overclocked any more but keeping it stable as well thanx in advance for the help  

    my corecenter temp sometimes says im at 60 cel at idle....and i have the most recent update...i would rely on speedfan for temp control...core center seems to always read 3 degrees higher than speedfan on my pc....
    i wouldnt be too concerned...those temps are pretty low to begin with.

  • Can anyone help me with getting the iframe widget to display the url properly?

    Can anyone help me with getting the iframe widget to display the url properly?

    Please elaborate more as what exactly you are referring to, which iframe widget ? also by url do you mean page url where you are using iframe ?
    Thanks,
    Sanjit

  • HT3986 Can anyone help me to get the Tack pad drivers for windows 7 on mAcBook Air..

    Can anyone help me to get the Tack pad drivers for windows 7 on mAcBook Air..

    If you've created the Windows 7 Drivers CD/USB drive, using Boot Camp Assistant in OSX, the drivers should be on there. My MacBook Pro (2010) touchpad works fine with those drivers installed, and I think it's identical to the Air's.
    http://support.apple.com/kb/HT4407 for info on how to create this drive.

  • Can anyone help me to change the file to version 8.6 ??

    can anyone help me to change the file to version 8.6 ??
    Attachments:
    Hydrostatic_Test.vi ‏2362 KB

    Duplicate Post.
    http://forums.ni.com/ni/board/message?board.id=170&thread.id=465548
    Tim
    Johnson Controls
    Holland Michigan

  • Hi can anyone help.  I have the wrt54gs router which work...

    hi
    can anyone help.  I have the wrt54gs router which works ok untill I switch my computer off or put it into standby it then switches the router off which disconnects my sons ps3 connection. any help greatly appreciated

    try changing the router's MTU for wired and change the advanced wireless settings on the router as well.

  • HT201285 can anyone help me recover deleted messages i deleted and saw through the Spotlight feature?

    I need help recovering my deleted text messages and coversations. I want to see the dates and all the info with them. can anyone help??

    Hello Brent208,
    It sounds like you want to restore messages that have been deleted. If you have an iCloud backup you may be able to restore from a previous date that has the data you want to restore. Keep in mind that this will restore your entire device to the way it was on that date, and any new photos, videos, or app data that has been saved since then will be erased.
    Before proceeding, be sure to back up your data to either iCloud or iTunes first:
    iOS: How to back up and restore your content
    http://support.apple.com/kb/HT1766
    Then use the following article to restore from your iCloud backup.
    iCloud: Restore your iOS device from iCloud
    https://support.apple.com/kb/ph12521
    Thank you for using Apple Support Communities.
    All the very best,
    Sterling

  • Can anyone help me with finding the preference in about:config I changed a week ago?

    changed something in preferences in the about:config files. need help

    Prefs that aren't the default show as bold on the <b>about:config</b> page. You can click the Status column header to sort by status. That may make it easier to remember which setting you've changed if you can't remember it.<br />
    Otherwise you can reset all prefs by deleting the prefs.js file or use the check-box on the Safe mode start window (Help > Restart with Add-ons Disabled).
    *http://kb.mozillazine.org/about:config
    *http://kb.mozillazine.org/Resetting_preferences

  • HT4060 My I pad 3 is not charging. When connected to the mains it just says Not Charging can anyone help me please as the I Pad is only 8 months old.

    My I pad 3 is showing not charging when trying to charge it. Can anyone help?

    Try this first - Reset the iPad by holding down on the Sleep and Home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons. (This is equivalent to rebooting your computer.)
    And this - Unplug the charger from the iPad and then replug. May resume charging.
    The quickest way (and really the only way) to charge your iPad is with the included 10W or 12W (5W on Mini) USB Power Adapter. iPad will also charge, although more slowly, when attached to a computer with a high-power USB port (many recent Mac computers) or with an iPhone Power Adapter (5W). When attached to a computer via a standard USB port (2.5W, most PCs or older Mac computers) iPad will charge very slowly (but iPad indicates not charging). Make sure your computer is on while charging iPad via USB. If iPad is connected to a computer that’s turned off or is in sleep or standby mode, the iPad battery will continue to drain.
    Apple recommends that once a month you let the iPad fully discharge & then recharge to 100%.
    How to Calibrate Your Mac, iPhone, or iPad Battery
    http://www.macblend.com/how-to-calibrate-your-mac-iphone-or-ipad-battery/
    At this link http://www.tomshardware.com/reviews/galaxy-tab-android-tablet,3014-11.html , tests show that the iPad 2 battery (25 watt-hours) will charge to 90% in 3 hours 1 minute. It will charge to 100% in 4 hours 2 minutes. The new iPad has a larger capacity battery (42 watt-hours), so using the 10W charger will obviously take longer. If you are using your iPad while charging, it will take even longer. It's best to turn your new iPad OFF and charge over night. Also look at The iPad's charging challenge explained http://www.macworld.com/article/1150356/ipadcharging.html
    Also, if you have a 3rd generation iPad, look at
    Apple: iPad Battery Nothing to Get Charged Up About
    http://allthingsd.com/20120327/apple-ipad-battery-nothing-to-get-charged-up-abou t/
    Apple Explains New iPad's Continued Charging Beyond 100% Battery Level
    http://www.macrumors.com/2012/03/27/apple-explains-new-ipads-continued-charging- beyond-100-battery-level/
    New iPad Takes Much Longer to Charge Than iPad 2
    http://www.iphonehacks.com/2012/03/new-ipad-takes-much-longer-to-charge-than-ipa d-2.html
    Apple Batteries - iPad http://www.apple.com/batteries/ipad.html
    Extend iPad Battery Life (Look at pjl123 comment)
    https://discussions.apple.com/thread/3921324?tstart=30
    New iPad Slow to Recharge, Barely Charges During Use
    http://www.pcworld.com/article/252326/new_ipad_slow_to_recharge_barely_charges_d uring_use.html
    Best Practices for iPad Battery Charging
    http://www.ilounge.com/index.php/articles/comments/best-practices-for-ipad-batte ry-charging/
    Tips About Charging for New iPad 3
    http://goodscool-electronics.blogspot.com/2012/04/tips-about-charging-for-new-ip ad-3.html
    How to Save and Prolong the battery life of your new ipad
    https://discussions.apple.com/thread/4480944?tstart=0
    Prolong battery lifespan for iPad / iPad 2 / iPad 3: charging tips
    http://thehowto.wikidot.com/prolong-battery-lifespan-for-ipad
    iPhone, iPod, Using the iPad Charger
    http://support.apple.com/kb/HT4327
    Install and use Battery Doctor HD
    http://itunes.apple.com/tw/app/battery-doctor-hd/id459702901?mt=8
    To Extend a Device’s Battery Life, Get to Know It Better
    http://tinyurl.com/b67c7xz
    iPad Battery Replacement
    http://www.apple.com/batteries/replacements.html
    In rare instances when using the Camera Connection Kit, you may notice that iPad does not charge after using the Camera Connection Kit. Disconnecting and reconnecting the iPad from the charger will resolve this issue.
     Cheers, Tom

  • Can anyone help me with deleting folders from Appleworks?

    I have an older computer that I am giving to a friend and I want to export and remove all of my personal folders in Appleworks (6.2.9). I have not been able to export info and I have also not been able to delete any folders from Appleworks. I can delete all the info in the individual file (ss or wp) but cannot remove the file itself. I don't know what I'm missing but I cannot find info on how to handle this problem. Can anyone help me with this?

    Search for the file's name in the Finder, throw it away, and empty the Trash; the Finder is the item in the Dock with the smiling face.
    (38373)

  • Can anyone help out in parsing the xml file.

    i have this file as string in webdynpro.
    can anyone help out how can i parse it and attch to context of webdynpro with structure
    queryList
       Queryid
       name
       remarks
    <?xml version="1.0" encoding="UTF-8"?>
    <app-data>
    <content-data hyperlink="" name="RegulatoryQueries" status="USER_VALID">
    <data>
    <element name="QUERY_SAVE_ID" type="Text" value="4"/>
    <element name="QUERY_NAME" type="Text" value="shal"/>
    <element name="REMARKS" type="Text" value=""/>
    </data><data><element name="QUERY_SAVE_ID" type="Text" value="20"/>
    <element name="QUERY_NAME" type="Text" value="test"/>
    <element name="REMARKS" type="Text" value="test"/>
    </data>
    <data>
    <element name="QUERY_SAVE_ID" type="Text" value="3"/>
    <element name="QUERY_NAME" type="Text" value="query_shal"/>
    <element name="REMARKS" type="Text" value="shaleel for testing on tomcat"/>
    </data>
    <data>
    <element name="QUERY_SAVE_ID" type="Text" value="8"/>
    <element name="QUERY_NAME" type="Text" value="sap"/>
    <element name="REMARKS" type="Text" value="Demo"/>
    </data>
    <data>
    <element name="QUERY_SAVE_ID" type="Text" value="10"/>
    <element name="QUERY_NAME" type="Text" value="TTTTT"/>
    <element name="REMARKS" type="Text" value="TTTTTTTTTTTTTTTTTTTTTtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttestend"/>
    </data>
    <data>
    <element name="QUERY_SAVE_ID" type="Text" value="6"/>
    <element name="QUERY_NAME" type="Text" value="RagQuery"/>
    <element name="REMARKS" type="Text" value="abcd"/>
    </data>
    <data>
    <element name="QUERY_SAVE_ID" type="Text" value="16"/>
    <element name="QUERY_NAME" type="Text" value="aa"/>
    <element name="REMARKS" type="Text" value="aaa"/>
    </data>
    <data>
    <element name="QUERY_SAVE_ID" type="Text" value="12"/>
    <element name="QUERY_NAME" type="Text" value="asda"/>
    <element name="REMARKS" type="Text" value="dasda"/>
    </data>
    <data>
    <element name="QUERY_SAVE_ID" type="Text" value="5"/>
    <element name="QUERY_NAME" type="Text" value="shalu"/>
    <element name="REMARKS" type="Text" value=""/>
    </data>
    <data>
    <element name="QUERY_SAVE_ID" type="Text" value="18"/>
    <element name="QUERY_NAME" type="Text" value="qry1234123"/>
    <element name="REMARKS" type="Text" value="aasdf"/>
    </data>
    <data>
    <element name="QUERY_SAVE_ID" type="Text" value="7"/>
    <element name="QUERY_NAME" type="Text" value="d"/>
    <element name="REMARKS" type="Text" value="sd"/>
    </data>
    <data>
    <element name="QUERY_SAVE_ID" type="Text" value="13"/>
    <element name="QUERY_NAME" type="Text" value="suresh"/>
    <element name="REMARKS" type="Text" value=""/>
    </data>
    <data>
    <element name="QUERY_SAVE_ID" type="Text" value="19"/>
    <element name="QUERY_NAME" type="Text" value="qrysdf"/>
    <element name="REMARKS" type="Text" value="sdfsd"/>
    </data>
    <data>
    <element name="QUERY_SAVE_ID" type="Text" value="22"/>
    <element name="QUERY_NAME" type="Text" value="llk"/>
    <element name="REMARKS" type="Text" value="dffnhjk"/>
    </data>
    <data>
    <element name="QUERY_SAVE_ID" type="Text" value="25"/>
    <element name="QUERY_NAME" type="Text" value="Query1"/>
    <element name="REMARKS" type="Text" value="Query1"/>
    </data>
    <data>
    <element name="QUERY_SAVE_ID" type="Text" value="30"/>
    <element name="QUERY_NAME" type="Text" value="1122"/>
    <element name="REMARKS" type="Text" value="w"/>
    </data>
    <data>
    <element name="QUERY_SAVE_ID" type="Text" value="32"/>
    <element name="QUERY_NAME" type="Text" value="11221"/>
    <element name="REMARKS" type="Text" value=""/>
    </data>
    <data>
    <element name="QUERY_SAVE_ID" type="Text" value="33"/>
    <element name="QUERY_NAME" type="Text" value="11222"/>
    <element name="REMARKS" type="Text" value=""/>
    </data>
    <data>
    <element name="QUERY_SAVE_ID" type="Text" value="34"/>
    <element name="QUERY_NAME" type="Text" value="11223"/>
    <element name="REMARKS" type="Text" value=""/>
    </data>
    <data>
    <element name="QUERY_SAVE_ID" type="Text" value="35"/>
    <element name="QUERY_NAME" type="Text" value="11224"/>
    <element name="REMARKS" type="Text" value=""/>
    </data>
    <data>
    <element name="QUERY_SAVE_ID" type="Text" value="36"/>
    <element name="QUERY_NAME" type="Text" value="11225"/>
    <element name="REMARKS" type="Text" value=""/>
    </data>
    <data>
    <element name="QUERY_SAVE_ID" type="Text" value="37"/>
    <element name="QUERY_NAME" type="Text" value="11226"/>
    <element name="REMARKS" type="Text" value=""/>
    </data>
    <data>
    <element name="QUERY_SAVE_ID" type="Text" value="38"/>
    <element name="QUERY_NAME" type="Text" value="11227"/>
    <element name="REMARKS" type="Text" value=""/>
    </data>
    <data>
    <element name="QUERY_SAVE_ID" type="Text" value="48"/>
    <element name="QUERY_NAME" type="Text" value="all fields"/>
    <element name="REMARKS" type="Text" value=""/>
    </data>
    <data>
    <element name="QUERY_SAVE_ID" type="Text" value="50"/>
    <element name="QUERY_NAME" type="Text" value="test34"/>
    <element name="REMARKS" type="Text" value=""/>
    </data>
    <data>
    <element name="QUERY_SAVE_ID" type="Text" value="27"/>
    <element name="QUERY_NAME" type="Text" value="12"/>
    <element name="REMARKS" type="Text" value="12"/>
    </data>
    <data>
    <element name="QUERY_SAVE_ID" type="Text" value="61"/>
    <element name="QUERY_NAME" type="Text" value="sureshcharan"/>
    <element name="REMARKS" type="Text" value=""/>
    </data>
    <data>
    <element name="QUERY_SAVE_ID" type="Text" value="62"/>
    <element name="QUERY_NAME" type="Text" value="charan"/>
    <element name="REMARKS" type="Text" value=""/>
    </data>
    <data>
    <element name="QUERY_SAVE_ID" type="Text" value="24"/>
    <element name="QUERY_NAME" type="Text" value="sss"/>
    <element name="REMARKS" type="Text" value="sss"/>
    </data>
    <data>
    <element name="QUERY_SAVE_ID" type="Text" value="64"/>
    <element name="QUERY_NAME" type="Text" value="test"/>
    <element name="REMARKS" type="Text" value=""/>
    </data>
    <data>
    <element name="QUERY_SAVE_ID" type="Text" value="53"/>
    <element name="QUERY_NAME" type="Text" value="afsdf"/>
    <element name="REMARKS" type="Text" value=""/>
    </data>
    <data>
    <element name="QUERY_SAVE_ID" type="Text" value="51"/>
    <element name="QUERY_NAME" type="Text" value="Satisfy al sets"/>
    <element name="REMARKS" type="Text" value=""/>
    </data>
    </content-data>
    </app-data>
    Thanks.
    dharmendra

    Hi dharmendra,
    Check
    Using the XML returned by XI to populate table in Web Dynpro UI
    Xml File processing
    Best regards, Maksim Rashchynski.

  • TS1559 nothing works with fixing my bluetooth on iphone 4. i cant sinc with my kia optima via bluetooth can anyone help me. none of the solutions that apple lists in their resolution section works.

    My bluetooth on my iphone does not sinc with my kia optima.  Can anyone help with this?  No solution listed by apple in their resolution section works with my phone.

    So what's the symptom you're seeing?  Can you go to Settings > General > Bluetooth and turn bluetooth on?
    Can you go to your Kia and turn its bluetooth on and have it discover nearby devices?

  • Can anyone help me to amend the SQL below?

    I do not know how to implement roles application in the Oracle Forms, so I have tried to use the below SQL to tackle this problem. The code below can be compiled successfull but its application of open form () cannot work. Can anyone help ?
    DECLARE
    rg_id RECORDGROUP;
    rg_name VARCHAR2(30);
    ret_code NUMBER;
    BEGIN
    rg_name := 'RG_LIST';
    rg_id := FIND_GROUP(rg_name);
    IF NOT ID_NULL(rg_id) THEN
    DELETE_GROUP(rg_id);
    END IF;
    rg_id :=CREATE_GROUP_FROM_QUERY( rg_name,'SELECT PASSWORD, into
    password_value FROM STAFF WHERE STAFF.LOGIN_ID =:LOGIN.LOGIN_ID');
    ret_code := POPULATE_GROUP( rg_id );
    --IF (ret_code <> 0) THEN
    -- Message ('no such user');
    -- RAISE FORM_TRIGGER_FAILURE;
    --END IF;
    if (:Login.password =
    Get_Group_Char_Cell(rg_name||'password_value',1)) THEN
    open_form('trans_tab');
    end if;
    end;

    Note that you may have more luck posting this sort of Forms-specific question in the Oracle Forms group.
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • Can anyone help me?Creating the shadow copies in the file server cluster ,there are some errors occured, OS version is WSS 2012

    I construct a failover cluster(file server,AP module) for sharing files by WSS 2012,and I want to use the shadow copies to backup my data,but when making  a shadow copies on the volume which  is added to the cluster(not the CSV,just add
    it to the cluster and use it to share files,it plays the role of file server),there are some errors occured, these errors result in the shadow copies failed,error likes the following pictures:
    1: the disk F is added to the cluster,first I make the shadow copies by click the right key of mouse on the disk F,and chouse the configeration shadow copies,and click the settings, then click the schedule , and I wait just a few seconds, the error is appeared,like
    this picture 1, the wait operation timed out,and then ,
    I click the schedule button once again,a different error occured,like the following picture," the object already exists",if i don't set the schedule at first ,use the default shedule,and click the enable button also the same  error must 
    accure
    but the only diffrence is that, a shadow copy time point is created, also ,you can make the shadow copies by click " create now", that is creating the shadow copies manually. Although it can succesfully make the shadow copies, but when I select
    a time point to revert, error  occured, "A volume that contains operating system files or resides on a cluster shared disk cannot be reverted" 
    In a word,all the errors above make the shadow copies by schedulling failed,except making the shadow copies manually,but what makes me confused is that I have ever maked the shadow copies succesfully by schedul a policy,I don't know what makes it succesful,
    it's small probability, most of time ,it's failed.No matter what kind of situation, revert must be failed.
    I'm sorry for my pool english , it's the first time for me getting help in forum by english ,I don't know if I descripe my question clearly, also ,other method like the link
    http://technet.microsoft.com/en-us/library/cc784118(v=ws.10).aspx I have tried,but the same errors occured.Can anyone tell me How can I make the shadow copies in File Server
    cluster(AP module)?And I make a mistake in operating? Looking forward for your reply.Thanks!

    Hi,
    Please check the following 2 places:
    HKEY_LOCAL_MACHINE\Cluster\Tasks
    C:\Windows\System32\Tasks
    First please compare permission settings of the folder C:\Windows\System32\Tasks with a working computer. Correct permission settings if anything wrong. Specifically, confirm you current account do have permission on this folder.
    As it said "object already exists", find the schedules you created before, backup and delete all these schedules in both registry key and folder.
    Then test to create a new schedule to see if issue still exists.
    Meanwhile what kind of storage device you are using? The issue could occur on specific storage device, so test to enable shadow copy on a local disk to see if that will work.
    TechNet Subscriber Support in forum |If you have any feedback on our support, please contact [email protected]
    Thank you for you reply.On the local volume,all of these errors will not occur, but the volume in the file server cluser.There is no value in HKEY_LOCAL_MACHINE\Cluster\Tasks. On local volume, everything goes well about the shadow copy, so I do not
    think something is wrong about the permission settings of the folder C:\Windows\System32\Tasks.Storage device  is a SAN,we use RAID6 and provide the LUNs to the NAS engine, and the make the volume on these LUNs, Is Angthing wrong? Hope for you
    reply~~

  • Can anyone help me to reinstate the BP with position.

    Hi
    Can anyone tell me how to re-assign the BP with the position if BP is deleted.
    Best Regards,
    Sridhar.k

    Hi
    <u><b>Please try this -></b></u>
    <b>1.</b>
    Go to Web Transaction "Manage Business Partner". (<u>BBPMAININT</u>)
    There are several options - go for "Employee for Business Partner" and enter in the field the supplier number or search for the supplier you want to create an employee for. Hit create and fill out the screen. The upper part of the screen creates the employee, in the lower part the user id (with which you logon) is maintained. The structure of the screen is asking all relevant elements needed to create a full SRM users and integrates the account into the Org Model.
    For the central Org Unit for Bidders enter the Node Number for the Vendor Root.
    How to assign contact person user id to Vendor uploaded from ECC?
    OR
    <b>2.</b> You need to go into <u>Transaction BP</u>, select the BP for whom you want to change their roles. Click on the change button and then you can select from the drop down field "Change in BP Role" the role that you need for that BP.
    Business Partner
    <u>Other related helpful links -></u>
    Re: Central Person already exists
    Re: regarding business partner, central person and organizational unit relation
    Central Person and BP ID
    How to delete Central Person?
    Re: to assign business partner no. to central person
    Do let me know.
    Regards
    - Atul

Maybe you are looking for

  • Unable to load Reports on Web

    We are working with Developer6.0,OAS 4.0.7, Oracle 8.0. We have a static implementation. Initially, we had Jinitiator 1.1.7.11. Reports were working fine. Later, We upgraded Jinitiator to 1.1.7.18. From then on I am unable to load reports on the web.

  • Multiple iTunes accounts

    I have recently tried to shift my iTunes account to a new email address and have found a problem with my app updates.  Since I've purchase many apps over time on an old iTunes account, automatic updates in iTunes are not listed for that account unles

  • My iPhone 4S will be playing music and then it will stop and go into dock connector mode. What do I do to stop this?

    Hi, my iPhone 4S will be playing music or nothing and it will randomly stop! I doesn't even show the volume bar. It goes right into dock connector mode when it's not even on a dock. It only does this when I want to play music through the iPhone speak

  • New keyboard software...

    We just installed a new keyboard and it is WONDERFUL!! the manual says that there is software that needs to be installed. So I dutifully went to apple.com/support/downloads and found several.. I clicked on the one that was called KeyboardSoftwareUpda

  • Catalog mapping error- with large entries

    Hello, When the catalog containing around 4000 items was uploaded, I received the error The exception occurred (program: /CCM/CL_MAPPING_MANAGER=======CP, include /CCM/CL_MAPPING_MANAGER=======CM00P, line: 465) However when the same catalog is gettin