/Linked List LOOP

  Node*floyeddetectLoop(Node*head){

            if(head==NULL)

            return NULL;

            

            Node*slow=head;

            Node*fast=head;

            while(slow!=NULL && fast!=NULL){

                fast=fast->next;

                if(fast!=NULL){

                    fast=fast->next;

                }

                slow=slow->next;

                if(slow==fast){

                    return slow;

                }

                

            

            return NULL;

        }

        // code here

        Node*getStartingNode(Node*head){

            if(head==NULL)

            return NULL:

            

            Node*intersection=floyeddetectLoop(head);

            Node*slow=head;

            while(slow!=intersection){

                slow=slow->next;

                intersection=intersection->next;

            }

            return slow;

        }

        

    



        void remove_Loop(Node*head){

            if(head==NULL)

            return;

            Node*startOfLoop=getStartingNode(head);

            Node*temp=startOfLoop;

            while(temp->next !=startOfLoop){

                temp=temp->next;

            }

            temp->next=NULL;

        }

 Bi_lindrome!

Difficulty Rating:1095            @Codechef



Problem

You are given a string  of length .

Your task is to delete a subsequence of maximum length from the string, such that, after concatenating the remaining parts of the string, it becomes a palindrome of length greater than 1.

If this is possible, print the maximum length of the subsequence that can be deleted. Otherwise, print 1.

Input Format

  • The first line of input will contain a single integer , denoting the number of test cases.
  • Each test case consists of 2 lines of input:
    • The first line consists the a single integer  - the length of string .
    • The second line contains string , consisting of lowercase english alphabets.

Output Format

For each test case, if it is possible to delete a subsequence under the given conditions, print a single integer, denoting the maximum length of the subsequence that can be deleted. Otherwise, print 1.

Constraints

  • 12500
  • 3100
  •  consists of lowercase english alphabets.

Sample 1:

Input                                           Output























































Samsung Guru FM Plus (SM-B110E/D, White)

 Samsung Guru FM Plus (SM-B110E/D, White)



Next page of related Sponsored Products

Product description

Colour:White

Design and Performance

If you are looking for a sturdy feature phone with a sleek design, the Samsung Guru dual SIM phone could be a great choice. Featuring a 7.36cm display, this durable handset comes with 5-way navigation keys and has a spacious TFT screen. It also has a sturdy bar design with attractive contrast edging and anti-dust keypad, making it even more user-friendly. Equipped with 256MB internal storage, the phone gives you enough room to store as much data as you want. Be it your contacts, music and more, the phone will run smoothly with this much storage capacity. The Samsung Guru is a good choice for all those who are looking for a pocket friendly phone with all the basic features.

Excellent Battery and Additional Features

One of the noteworthy features of Samsung Guru is its impressive battery life. Fitted with 256MB internal storage, the handset allows a talk-time of 8 hours in a single charge and a standby time of 450 hours. The high energy battery of the phone does not get drained easily; you can enjoy uninterrupted chatting with family and friends. Other than this, the phone comes with a lot of other features like FM radio, MP3 ringtones, 2G connectivity, multi-language compatibility, loud speaker, call waiting and much more for your convenience. The above description is for the SAMSUNG GURU FM Plus SM-B110E/D today.


Compare with similar items


Samsung Guru FM Plus (SM-B110E/D, White)
Samsung Guru Music 2 (SM-B310E, White)
Nokia 105 Single SIM (Black)
Samsung Guru 1200 (GT-E1200, White)
Customer Rating4.1 out of 5 stars (7273) 4.2 out of 5 stars (19093) 4.0 out of 5 stars (14429) 4.2 out of 5 stars (12354) 
Price₹ 1,449.00₹ 1,948.00₹ 1,140.00₹ 1,320.00
ShippingFulfilled FREE DeliveryDetailsFulfilled FREE DeliveryDetailsFulfilled FREE DeliveryDetailsFulfilled FREE DeliveryDetails
Sold ByAppario Retail Private LtdHardtracAppario Retail Private LtdHardtrac
Battery Power800800800800
Connectivity TechnologyGSMGSM(900/1800 MHz)GSMGSM(900/1800 MHz)
Screen Size1.5 in2 in1.8 in1.52 in
Effective Still Resolution0 megapixels0 megapixels0 megapixels
Included ComponentsHandset, Battery, Charger and User GuideHandset, Battery, Charger, Headset and User Manual1 Cellular Phones, 1 Battery, 1 Charger and 1 User guideHandset, Battery, Charger and User Guide
Item Weight66 grammes75 grammes165 grammes65 grammes
Lithium Battery Energy Content4.9 watt hours4.9 watt hours3 watt hours4.9 watt hours
Special FeaturesRadioDual Sim; Radio; Music Player; FM RadioSingle SIMRadio

From the manufacturer

/Linked List LOOP

  Node*floyeddetectLoop(Node*head){             if(head==NULL)             return NULL;                          Node*slow=head;            ...