File tree Expand file tree Collapse file tree 6 files changed +58
-8
lines changed Expand file tree Collapse file tree 6 files changed +58
-8
lines changed Original file line number Diff line number Diff line change @@ -19,8 +19,8 @@ Power of 2			02/22/2021		ExponentTwo
1919Product Digits		02/22/2021		MathProduct
2020Question Marks      02/24/2021      QuestionMarkSum
2121Remove Brackets     02/24/2021      StringBrackets
22- Simple Adding
23- Simple Symbols
22+ Simple Adding       02/24/2021      MathSummation 
23+ Simple Symbols      02/24/2021      StringSymbols 
2424String Periods
2525Time Convert        2/10/2021	    TimeConverter
2626Username Validation
Original file line number Diff line number Diff line change 11using  System ; 
2- using  System . Collections . Generic ; 
3- using  System . Linq ; 
4- using  System . Text ; 
5- using  System . Threading . Tasks ; 
62
7- namespace  Coderbyte_CSharp . _Easy_Challenges 
3+ namespace  Coderbyte_CSharp . Easy_Challenges 
84{ 
95    class  MathFibonacci 
106    { 
Original file line number Diff line number Diff line change 1+ using  System ; 
2+ 
3+ namespace  Coderbyte_CSharp . Easy_Challenges 
4+ { 
5+     class  StringSymbols 
6+     { 
7+         // Have the function SimpleSymbols(str) take the str parameter being passed and  
8+         // determine if it is an acceptable sequence by either returning the string true  
9+         // or false. The str parameter will be composed of + and = symbols with several  
10+         // characters between them (ie. ++d+===+c++==a) and for the string to be true  
11+         // each letter must be surrounded by a + symbol. So the string to the left would  
12+         // be false. The string will not be empty and will have at least one letter. 
13+ 
14+         public  string  SimpleSymbols ( string  str ) 
15+         { 
16+             string  result  =  String . Empty ; 
17+             bool    found   =  false ; 
18+ 
19+             for  ( int  index  =  0 ;  index  <  str . Length  &&  ! found ;  ++ index ) 
20+             { 
21+                 if  ( Char . IsSymbol ( str [ index ] )  ||  Char . IsLetterOrDigit ( str [ index ] ) ) 
22+                 { 
23+                     if  ( ( index  ==  0 )  &&  ( index  ==  str . Length  -  1 ) ) 
24+                     { 
25+                         break ; 
26+                     } 
27+                     else  if  ( index  !=  str . Length - 1  &&  
28+                              index  !=  0  && 
29+                              str [ index  -  1 ]  ==  '+'  &&  
30+                              str [ index  +  1 ]  ==  '+' ) 
31+                     { 
32+                         found  =  true ; 
33+                     } 
34+                 } 
35+             } 
36+ 
37+             result  =  found  ?  "true"  :  "false" ; 
38+ 
39+ 
40+             return  result ; 
41+         } 
42+     } 
43+ } 
Original file line number Diff line number Diff line change 5959    <Compile  Include =" 1 Easy Challenges\StringBrackets.cs" 
6060    <Compile  Include =" 1 Easy Challenges\StringIntersection.cs" 
6161    <Compile  Include =" 1 Easy Challenges\StringReverse.cs" 
62+     <Compile  Include =" 1 Easy Challenges\StringSymbols.cs" 
6263    <Compile  Include =" 1 Easy Challenges\StringWords.cs" 
6364    <Compile  Include =" 1 Easy Challenges\TimeConverter.cs" 
6465    <Compile  Include =" 2 Medium Challenges\ConsecutiveNumbers.cs" 
Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ static void Main(string[] args)
3434            tc . Test_RemoveBrackets ( ) ; 
3535            tc . Test_FibonacciChecker ( ) ; 
3636            tc . Test_SimpleAdding ( ) ; 
37+             tc . Test_SimpleSymbols ( ) ; 
3738
3839            // Medium 
3940            Console . WriteLine ( "Medium Code Challenges:" ) ; 
Original file line number Diff line number Diff line change 22using  System . Collections . Generic ; 
33using  System . Linq ; 
44using  System . Text ; 
5- using  Coderbyte_CSharp . _Easy_Challenges ; 
65using  Coderbyte_CSharp . Easy_Challenges ; 
76using  Coderbyte_CSharp . Medium_Challenges ; 
87using  Coderbyte_CSharp . Hard_Challenges ; 
@@ -385,7 +384,17 @@ public void Test_SimpleAdding()
385384            Console . WriteLine ( "Input: {0}" ,  num ) ; 
386385            Console . WriteLine ( "Output:  {0}" ,  sum . SimpleAdding ( num ) ) ; 
387386            Console . WriteLine ( ) ; 
387+         } 
388+ 
389+         public  void  Test_SimpleSymbols ( ) 
390+         { 
391+             StringSymbols  symbols  =  new  StringSymbols ( ) ; 
392+             Console . WriteLine ( "Simple Symbols:" ) ; 
388393
394+             string  str  =  "++d+===+c++==a" ; 
395+             Console . WriteLine ( "Input: {0}" ,  str ) ; 
396+             Console . WriteLine ( "Output:  {0}" ,  symbols . SimpleSymbols ( str ) ) ; 
397+             Console . WriteLine ( ) ; 
389398        } 
390399
391400
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments