Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

first duplicate

def solution(a):
    
    arr = []
    
    for i in range(len(a)):
        for j in range(i+1,len(a)):
            if a[i]==a[j]:
                hash.append(j)
    if len(hash) == 0:
        return -1
    else:
        idx = min(hash)
        return a[idx]

a = [2, 3, 4, 6, 5, 3]
Solution(a)
Comment

first duplicate

def Solution(a):
  arr = []
  value=[]
  for i in range(len(a)):
    if a[i] not in hash:
      hash.append(a[i])
    else:
      value.append(i)
  if len(value) ==0:
    return -1
  else:
    idx = min(value)
    return a[idx]

# a = [1,2,3,4,4,2]
a=[1,2,3,4]
Solution(a)
Comment

PREVIOUS NEXT
Code Example
Python :: 405 Method Not Allowed When Redirecting in Flask within POST route 
Python :: Trying to use image in Flask website only shows broken img icon 
Python :: sklearn encoding pipelin 
Python :: python assert multiple conditions 
Python :: Flask error: werkzeug.routing.BuildError 
Python :: session timeout flask 
Python :: python while loop command gaming code 
Python :: DD python ue5 set material interface 
Python :: OddOccurrencesInArray 
Python :: parseint python equivalent 
Python :: sns.kdeplot make line more detailed 
Python :: ring print part of the content of a binary file 
Python :: easy ocr python pypi 
Python :: ring Type Hints Library user types 
Python :: notebook prevent cell output 
Python :: update a variable in torch 
Python :: matplotlib doesnt show suptitle 
Python :: zero error 
Python :: pandas count zeros in column 
Python :: I want to add a new column to the DataFrame containing only the month of the measurement 
Python :: tf.stop_gradient in pytorch 
Python :: rolingmean python 
Python :: convert int to binary python 
Python :: diamond shape alphabatical pattern program in python 
Python :: nptel swayam 
Python :: check internet speed using python 
Python :: python no mathcing key method found 
Python :: fibonacci series stackoverflow 
Python :: test a decorator python 
Python :: alignment to numpy array 
ADD CONTENT
Topic
Content
Source link
Name
6+2 =