#Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target

class Solution:
    def twoSum(self, nums: List[int], target: int) -> List[int]:
        for i in range(len(nums)):
            for j in range(i + 1, len(nums)):
                if nums[i] + nums[j] == target:
                    return(i, j)
                  
                  
#Given an integer x, return true if x is palindrome integer.
#An integer is a palindrome when it reads the same backward as forward.
#For example, 121 is a palindrome while 123 is not.

class Solution:
    def isPalindrome(self, x: int) -> bool:
        rev = 0
        init_n = x
        if( x < 0):
            return False
        while x != 0:
            rev = (rev*10) +  x % 10
            x = x // 10
    
        if(rev == init_n):
            return True
        return False
      
#Given an integer array nums, return true if any value appears at least twice in the array, and return false if every element is distinct.
class Solution:
    def containsDuplicate(self, nums: List[int]) -> bool:
        if len(nums) != len(set(nums)):
            return True
        return False
        
# Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum.
# A subarray is a contiguous part of an array.
class Solution:
    def maxSubArray(self, nums: List[int]) -> int:
        currentSum = nums[0]
        maxSum = nums[0]
        for i in range(1,len(nums)):
            currentSum += nums[i]
            currentSum = max(currentSum, nums[i])
            maxSum  = max(maxSum, currentSum)
            
        return maxSum
