Create a bug report to help us improve our content -
Your email registered on BackToBackSWE : 1996.birukalia@gmail.com
Biranchi Padhi
Category of the bug :
[ ] Question
[x] Solution
[ ] Language
Solution
Description of the bug :
I have a python solution and I want to contribute the same for Bi-partite graph question on Back-Back SWE platform. We do not have solution for Python and hence I wanted to contribute it.
Code you used for Submit/Run operation :
<!-- Code Goes Here -->
class Solution:
def isBipartite(self, adjList):
'''
:type adjList: list of list of int
:rtype: bool
'''
q=[]
self.adjList = adjList
self.UNCOLORED = -1
self.color = [self.UNCOLORED]*len(adjList)
for node in range(len(self.adjList)):
if self.color[node] == self.UNCOLORED:
q.append(node)
self.color[node] = 1
if not self.BFS(q):
return False
return True
def BFS(self,q):
while q:
current = q.pop(0)
for neighbor in self.adjList[current]:
if self.color[neighbor] == self.UNCOLORED:
self.color[neighbor] = 1-self.color[current]
q.append(neighbor)
else:
if self.color[neighbor] == self.color[current]:
return False
return True
Language used for code :
Python
Expected behavior :
It is accepted in Leetcode's and Bakc-toback-swe's Console.
Back To Back SWE
Create a bug report to help us improve our content -
Your email registered on BackToBackSWE : 1996.birukalia@gmail.com
Biranchi Padhi
Category of the bug :
Description of the bug :
I have a python solution and I want to contribute the same for Bi-partite graph question on Back-Back SWE platform. We do not have solution for Python and hence I wanted to contribute it.
Code you used for Submit/Run operation :
Language used for code :
Python
Expected behavior :
It is accepted in Leetcode's and Bakc-toback-swe's Console.
Screenshots :
Additional context :