This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class StoriesDataSourceProvider : DataSourceProvider { | |
override fun getDataSource(context:Context) : DataSource { | |
//build dependencies | |
return datasource | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dynamicFeatures = [':module2', ':module3'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
implementation project(':app') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
implementation project(':module1') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Solution: | |
def search(self, nums: List[int], target: int) -> int: | |
pivot = self.get_pivot(nums, 0, len(nums)-1) | |
if pivot == -1: | |
return self.binary_search(nums, target, 0, len(nums)-1) | |
if target == nums[pivot]: | |
return pivot | |
elif target >= nums[0]: | |
return self.binary_search(nums,target, 0, pivot-1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Solution: | |
def numIslands(self, grid): | |
if not grid: | |
return 0 | |
count = 0 | |
for i in range(len(grid)): | |
for j in range(len(grid[0])): | |
if grid[i][j] == '1': | |
self.dfs(grid, i, j) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[28, 17] |