Programming probems

String problems
.java







  

Practice these problems based on string.



  




  

// input - hello this is nody // output - nody is this world




  

Check for balanced parentheses in an expression




  

Given, the total levels in a hill pattern (input1),
the weight of the head level (input2), and
the weight increments of each subsequent level (input3),
you are expected to find the total weight of the hill pattern.
  "Total levels" represents the number of rows in the pattern.
"Head level" represents the first row.
Weight of a level represents the value of each star (asterisk) in that row.   
The hill patterns will always be of the below format, starting with 1 star at head level and increasing 1 star at each level till level N.
*
**
***
****
*****
******
. . .and so on till level N
the total levels in the hill pattern = 5 (i.e. with 5 rows)
the weight of the head level (first row) = 10
the weight increments of each subsequent level = 2
Then, The total weight of the hill pattern will be calculated as = 10 + (12+12) + (14+14+14) + (16+16+16+16) + (18+18+18+18+18) = 10 + 24 + 42 + 64 + 90 = 230




  

Serial Killer Q1 The detective is out to catch a serial killer. The serial killer is out on killing spree till he has killed people with house number helping him reach his black magic number. The house numbers that are provided to you to see whether he has reached his magic number are: 1442, 12, 332, 456, 5588 The killer only add numbers if the house numbers are stable i.e. the frequency of each digit in the house number is exactly same. If the frequency of any of the digit is not same, then the house number is not added to attain his magic number. The detective needs your help to create a program to see whether the serial killer will continue his hunt or not. For the given test case see, answer whether he will continue his killing spree given his black magic number is 6000.




  

array left rotation




  

array right rotation




other avilable courses


codenody