Ad

:) (i don't know how to code)

Code
Diff
  • public static class Kata
    {
    		public static int SameCase(char a, char b) => !(char.IsLetter(a) && char.IsLetter(b)) ? -1 : char.IsUpper(a) == char.IsUpper(b) ? 1 : 0;
    }
    
    • public static class Kata
    • {
    • public static int SameCase(char a, char b)
    • => !(char.IsLetter(a) && char.IsLetter(b)) ? -1
    • : char.IsUpper(a) == char.IsUpper(b) ? 1 : 0;
    • public static int SameCase(char a, char b) => !(char.IsLetter(a) && char.IsLetter(b)) ? -1 : char.IsUpper(a) == char.IsUpper(b) ? 1 : 0;
    • }

basically refactored

Code
Diff
  • def max_sequence(arr):
        # Code to find maximum sum of subarray
    	sum_b = sum(arr)
    	for i in range(len(arr)):
    		for k in range(len(arr)-i+1):
    			sum_c = sum(arr[k:k+i])
    			if sum_c > sum_b: sum_b = sum_c
    	return(sum_b)
    
    • def max_sequence(arr):
    • # Code to find maximum sum of subarray
    • l_a = len(arr)
    • sum_b = sum(arr)
    • for i in range(l_a):
    • for k in range(l_a-i+1):
    • for i in range(len(arr)):
    • for k in range(len(arr)-i+1):
    • sum_c = sum(arr[k:k+i])
    • if sum_c > sum_b: sum_b = sum_c
    • return(sum_b)

.IsUpper() returns bools for you

Code
Diff
  • public static class Kata
    {
    		public static int SameCase(char a, char b) {
    			if (char.IsLetter(a) && char.IsLetter(b))
    			{
    				if (char.IsUpper(a) == char.IsUpper(b))
    				{
    					return 1;
    				}
    				else
    			  {
    					return 0;
    				}
    			}
    			return -1;
    		}
    }
    • public static class Kata
    • {
    • public static int SameCase(char a, char b) {
    • bool areBothCharsLetter = char.IsLetter(a) && char.IsLetter(b);
    • bool areSameLetters = char.IsUpper(a) == char.IsUpper(b);
    • if (areBothCharsLetter)
    • if (char.IsLetter(a) && char.IsLetter(b))
    • {
    • if (areSameLetters)
    • if (char.IsUpper(a) == char.IsUpper(b))
    • {
    • return 1;
    • }
    • else
    • {
    • {
    • return 0;
    • }
    • }
    • return -1;
    • }
    • }

ez

Code
Diff
  • def other_angle(a, b): return 180 - (a + b)
    
    
    • def other_angle(a, b):
    • req_angle = 180 - (a + b)
    • return req_angle
    • def other_angle(a, b): return 180 - (a + b)