From ecd5c86424274fb75e3a54137040c34ec73c8e5c Mon Sep 17 00:00:00 2001 From: PUVVADA BHASKAR <2400030295@kluniversity.in> Date: Sat, 1 Nov 2025 20:42:41 +0530 Subject: [PATCH] Add minOperations method for string transformation Implement minOperations to calculate minimum operations to transform a string. --- Minimum Operations to Transform String | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 Minimum Operations to Transform String diff --git a/Minimum Operations to Transform String b/Minimum Operations to Transform String new file mode 100644 index 00000000..0916fda2 --- /dev/null +++ b/Minimum Operations to Transform String @@ -0,0 +1,12 @@ +class Solution: + def minOperations(self, s: str) -> int: + an = float('inf') + for target in range(26): + maxo = 0 + for ch in s: + dif = (26 - (ord(ch)- ord('a')) )%26 + maxo = max(maxo,dif) + an = min(an,maxo) + + return an +