Read Time:41 Second
Example 1:
Input: s = "abcabcbb" Output: 3 Explanation: The answer is "abc", with the length of 3. Example 2: Input: s = "bbbbb" Output: 1 Explanation: The answer is "b", with the length of 1. Example 3: Input: s = "pwwkew" Output: 3 Explanation: The answer is "wke", with the length of 3. Notice that the answer must be a substring, "pwke" is a subsequence and not a substring.
Python Solution
class Solution(object):
def lengthOfLongestSubstring(self, s):
"""
:type s: str
:rtype: int
"""
if(len(s)==0):
return 0
listSize=[]
temp=""
for i in range(len(s)):
temp=""
for j in range(i,len(s)):
#if element present in string break
if s[j] in temp:
break
else:
temp=temp+s[j]
listSize.append(len(temp))
if len(listSize)>=1:
return max(listSize)
return len(s)
Today, I went to the beach with my children. I found a sea shell and gave it to my 4 year old daughter and said “You can hear the ocean if you put this to your ear.” She put the shell to her ear and screamed. There was a hermit crab inside and it pinched her ear. She never wants to go back! LoL I know this is totally off topic but I had to tell someone!
Thank you for the auspicious writeup. It in fact was a amusement account it. Look advanced to far added agreeable from you! By the way, how can we communicate?
Thank you for the auspicious writeup. It if truth be told was once a leisure account it. Look complex to more delivered agreeable from you! However, how could we keep up a correspondence?
Its revenue also declined 1 to Rs 3,350 crore in FY20.
F*ckin? awesome things here. I am very glad to see your post. Thanks a lot and i am looking forward to contact you. Will you please drop me a mail?
I am not sure where you’re getting your information, but great topic. I needs to spend some time learning more or understanding more. Thanks for excellent information I was looking for this info for my mission.