Posts

Showing posts from June, 2021

PRINT TRUE IF FIRST STRING IS A SUBSTRING OF FIRST STRING,ELSE PRINT FALSE

 PRINT TRUE IF FIRST STRING IS A SUBSTRING OF FIRST STRING,ELSE PRINT FALSE NOTE:* symbol can replace n number of characters Input: Spoon Sp*n  Output: TRUE           Zoho   *o*o   Output: TRUE           Man    n*       Output:FALSE           Subline line    Output:TRUE PROGRAM: import   java . util .*; public   class   zohostring  {      public   static   void   checkContains ( String   s1 , String   s2 )     {          String   s3 = "" ;          int   flag = 0 ;          for ( int   i = 0 ; i < s1 . length ();)         {           ...

ACTIVE TRADERS

 PROBLEM STATEMENT: An institutional broker wants to review the book of  customers to see which are most active. Given a list of trades by customer name,determine which customers account for the atleast 5% of the total numbers of trades.Order the list alphabetically ascending by name. I/P : 23 BigCrop BigCrop Acme BigCrop Zork Zork Abc BigCrop Acme BigCrop BigCrop Zork BigCrop Zork Zork BigCrop Acme BigCrop Acme BigCrop Acme Littlecorp Nadircorp O/P: {BigCrop= 10 , Abc= 1 , Littlecorp= 1 , Zork= 5 , Acme= 5 , Nadircorp= 1 } [Acme, BigCrop, Zork] PROGRAM: import   java . util .*; public   class   ActiveTraders  {      public   static   void   toSortPercent ( ArrayList < String >  al )     {          HashMap < String , Integer >  hm = new   HashMap <>();        ...

CHECK THE GIVEN WORD IS PRESENT IN THE GIVEN 2D ARRAY EITHER VERTICALLY OR HORIZONTALLY

 PROBLEM: JAVA PROGRAM TO  CHECK THE GIVEN WORD IS PRESENT IN THE GIVEN 2D ARRAY EITHER VERTICALLY OR HORIZONTALLY I/P: 3 A B C D E F G H I 1. ABC 2. ADG 3.CEG O/P: 1. THE GIVEN WORD IS PRESENT IN THE ARRAY 2. THE GIVEN WORD IS PRESENT IN THE ARRAY 3. THE GIVEN WORD IS NOT PRESENT IN THE ARRAY PROGRAM: import   java . util .*; public   class   wordPresentinOrder  {      public   static   void   toFind ( char   arr [][], int   iNum , String   s1 )     {          int   r = iNum ; int   c = iNum ;          int   row = 0 , col = 0 ;          int   count = 0 ;          int   count2 = 0 ;          int   flag = 0 ;          while ...