Join us Create a HackerRank account Be part of a 26 million-strong community of developers Please signup or login in order to view this challenge I agree to HackerRank's Terms of Service and Privacy Policy. Sign up or Continue with Google LinkedIn GitHub Facebook Already have an account?Log in
1if__name__=='__main__':2n =int(input())3arr =map(int, input().split())4print(sorted(list(set(arr)))[-2])
defcount_substring(string,sub_string):count=0ls,lss=len(string),len(sub_string)foriinrange(0,ls-lss+1):ifstring[i:i+lss]==sub_string:count+=1returncount 0
here is the solution of problem f**ind a string** https://solution.programmingoneonone.com/2020/06/hackerrank-find-string-problem-solution-python.html -1|ParentPermalink manoharkharvi051 5 years ago count = 0 for i in range(0,len(string)-len(sub_string)+2): if (string[i:i+len(sub_...
defcount_substring(string,sub_string):list_string=[]dup_string=string[:]foriinrange(1,len(string)):iflen(dup_string)>=len(sub_string):chars=dup_string[-len(sub_string):]list_string.append(chars)dup_string=dup_string[:-1]return(list_string.count(sub_string))...
defcount_substring(string,sub_string):count=0ls,lss=len(string),len(sub_string)foriinrange(0,ls-lss+1):ifstring[i:i+lss]==sub_string:count+=1returncount
Moreover, it gives hint that if index variable is underscore, then its not used in the following code. Being said that, its matter of personal preference and you could use any valid special character or use conventional alphabets instead. ...
Find a string Writing one line but hard to undestand code is not considered a good programming practice.You will grasp when you gradually become mastered in Python.However I think writing this type of things only for fun is most suitable....