diff --git a/Arrays/Move_Zeroes.java b/Arrays/Move_Zeroes.java index 96d0c7b..f2e9597 100644 --- a/Arrays/Move_Zeroes.java +++ b/Arrays/Move_Zeroes.java @@ -2,21 +2,21 @@ class Solution { public void moveZeroes(int[] nums) { - int cnt = 0; + int cnt = 0; int index = 0; - for(int i=0 ; i < nums.length ; i++){ - if(nums[i] == 0) cnt++; - else{ + for (int i = 0; i < nums.length; i++) { + if (nums[i] == 0) + cnt++; + else { nums[index] = nums[i]; index++; } - + } - - for(int i=nums.length-1 ; i>=nums.length - cnt ; i--){ + for (int i = nums.length - 1; i >= nums.length - cnt; i--) { nums[i] = 0; } - - for(int i=0 ; i < nums.length ; i++) System.out.print(nums[i]+" "); + for (int i = 0; i < nums.length; i++) + System.out.print(nums[i] + " "); } } diff --git a/String/DoorMat.py b/String/DoorMat.py deleted file mode 100644 index cb532b9..0000000 --- a/String/DoorMat.py +++ /dev/null @@ -1,28 +0,0 @@ -""" -Prints a door mat of size N * M (N is an odd natural number, and M is 3 times N). -Input format: -A single line containing the space separated values of N and M. -""" - -string_input = input() -measurements = string_input.split() -length = int(measurements[0]) -breadth = int(measurements[1]) - -triangle= ".|." -line_number = 1 -half_height = length//2 - -# top part -for i in range(half_height): - print((triangle*line_number).center(breadth, '-')) - line_number += 2 - -# center -middle = "WELCOME" -print(middle.center(breadth,'-')) - -# lower part -for i in range(half_height): - print((triangle*(line_number-2)).center(breadth, '-')) - line_number -= 2 \ No newline at end of file diff --git a/String/sWAPcASE.py b/String/sWAPcASE.py deleted file mode 100644 index a86d92b..0000000 --- a/String/sWAPcASE.py +++ /dev/null @@ -1,26 +0,0 @@ -""" -Converts and Returns all lowercase letters to uppercase letters and vice versa. -""" - -def swap_case(string): - lst= list() - ascii_val = list(map(ord, string)) - - for value in ascii_val: - if value>64 and value<92: - value = value + 32 - elif value>96 and value<124: - value = value - 32 - else: - value = value - lst.append(value) - scase = list(map(chr , lst)) - - res = "" - for c in scase: - res += c - - return res - -str_input = input() -print(swap_case(str_input)) \ No newline at end of file