Skip to content

Instantly share code, notes, and snippets.

View vamsitallapudi's full-sized avatar
🚩
Become better than yesterday

Vamsi Tallapudi vamsitallapudi

🚩
Become better than yesterday
View GitHub Profile
class ExampleFragment : Fragment() {
...
...
companion object {
fun newInstance() : ExampleFragment {
return ExampleFragment()
}
}
}

Python Interview Questions And Answers

Curated List of Real-time Python Interview Questions. Help fellow developers by contributing to these interview Questions - Create a pull request in Github.

  • What is Python?
    A) Python is an interpreted, high-level, general-purpose programming language. The significant feature of Python Programming Language is its code readability. Python is open source, which makes it free to use and distribute.

  • What are the advantages of using Python?
    A) Python is mainly used for the following:

@vamsitallapudi
vamsitallapudi / print_permutations.py
Last active February 13, 2020 16:22
Print permutations of a given string using Python
def toStr(list):
return ''.join(list)
def permute(s, l, r):
"""
Function to find permutations of a given sting
:arg s : string,
:arg l : left element of the string,
:arg r : right element of the string.
"""
# python program to print a square using lambda function
square = lambda x : x**2
print(square(3))
# python program to find volume of a cube
volume = lambda l,b,h : l*b*h
print(volume(3,2,4))
# python program to print below average marks
marks = [100, 76, 45, 28, 52, 17, 83]
below_average = list(filter(lambda x : x<35, marks))
print(below_average)
@vamsitallapudi
vamsitallapudi / PageKeyedNearlensStoryDataSource.kt
Created April 2, 2020 13:07
PageKeyedNearlensStoryDataSource.kt
package com.coderefer.nearlens.ui.storyList.data
import android.content.Context
import androidx.lifecycle.MutableLiveData
import androidx.paging.PageKeyedDataSource
import com.coderefer.nearlens.data.models.Story
import com.coderefer.nearlens.domain.api.NearlensService
import com.coderefer.nearlens.exceptions.APIException
import com.coderefer.nearlens.util.LIST_SCREEN_STORY_LIMIT
import kotlinx.coroutines.CoroutineScope
class Solution:
def isHappy(self, n: int) -> bool:
result = False
visited = set()
while not result and n not in visited:
visited.add(n)
p = [int(_) for _ in str(n)]
n = sum(list(map(lambda a: a ** 2, p)))
if n == 1:
result = True
class Solution:
def diameterOfBinaryTree(self, root: TreeNode) -> int:
self.globalLongestPath = 0
self.depth(root)
return self.globalLongestPath
def depth(self, node:TreeNode)-> int:
if not node:
return 0