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

Questions solved:
three-way-partitioning

two pointer approach.

left=left-1 increment only if find do same for right .

As I am going to begin with LinkedList: Wanted to freshen up on OOPS concept(has been a long time since las…


This content originally appeared on DEV Community and was authored by Kishore kunal

Questions solved:
three-way-partitioning

two pointer approach.

left=left-1 increment only if find do same for right .

Image description

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

rotate-string

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

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

`species='mammal'

class Dog():
def init(self,breed,name):
self.breed=breed
self.name=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(self.name,number))

my_dog=Dog('lab','Frankie')

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

print(my_dog.breed,my_dog.name)

my_dog.bark(10)

called method

class circle:
#clas sobject attribute

def __init__(self):
    self.pi=3.15
def circumference(self,radius):
        return radius*self.pi*2

C=circle()
C.circumference(2)`


This content originally appeared on DEV Community and was authored by Kishore kunal


Print Share Comment Cite Upload Translate Updates
APA

Kishore kunal | Sciencx (2022-03-30T19:40:04+00:00) #day 11 of solving 450 questions[34/450]. Retrieved from https://www.scien.cx/2022/03/30/day-11-of-solving-450-questions34-450/

MLA
" » #day 11 of solving 450 questions[34/450]." Kishore kunal | Sciencx - Wednesday March 30, 2022, https://www.scien.cx/2022/03/30/day-11-of-solving-450-questions34-450/
HARVARD
Kishore kunal | Sciencx Wednesday March 30, 2022 » #day 11 of solving 450 questions[34/450]., viewed ,<https://www.scien.cx/2022/03/30/day-11-of-solving-450-questions34-450/>
VANCOUVER
Kishore kunal | Sciencx - » #day 11 of solving 450 questions[34/450]. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2022/03/30/day-11-of-solving-450-questions34-450/
CHICAGO
" » #day 11 of solving 450 questions[34/450]." Kishore kunal | Sciencx - Accessed . https://www.scien.cx/2022/03/30/day-11-of-solving-450-questions34-450/
IEEE
" » #day 11 of solving 450 questions[34/450]." Kishore kunal | Sciencx [Online]. Available: https://www.scien.cx/2022/03/30/day-11-of-solving-450-questions34-450/. [Accessed: ]
rf:citation
» #day 11 of solving 450 questions[34/450] | Kishore kunal | Sciencx | https://www.scien.cx/2022/03/30/day-11-of-solving-450-questions34-450/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.