DEV Community

Kishore kunal
Kishore kunal

Posted on

#day 11 of solving 450 questions[34/450]

Questions solved:

two pointer approach.

left=left-1 increment only if find <a , right = max ,

decrement only if find do same for right .
Image description


Beautiful Solution :
len(s)==len(goal) and goal in s+s

0(n) possible through KMP (not learned yet)

As I am going to begin with LinkedList: Wanted to freshen up on OOPS concept(has been a long time since last used it)


class Dog():
def init(self,breed,name):

  1. init can be thought as constructor for the class
  2. it will be called automatically when u create instance of a class
  3. self->represents as instance of the object itself.
  4. attribute
  5. we take in the argument
  6. assign it using self.attrivute_name
  7. operations/acitons----->method is a fn that is inside of class that will work with object in some way def bark(self,number): print("WOOF! my name is {} and my number is {}".format(,number))


  • notice this we are getting an error as we havent given any positional argument
  • because we are expecting breed parameter
  • so lets pass one
  • notice that attributes , never have () that because attributes it not something you execu
  • it is something you call back



called method

class circle:
#clas sobject attribute

def __init__(self):
def circumference(self,radius):
        return radius*self.pi*2
Enter fullscreen mode Exit fullscreen mode


Top comments (0)