zoukankan      html  css  js  c++  java
  • [LintCode] Connecting Graph

    Given n nodes in a graph labeled from 1 to n. There is no edges in the graph at beginning.

    You need to support the following method:

    1. connect(a, b), add an edge to connect node a and node b. 2.query(a, b)`, check if two nodes are connected

    Example

    5 // n = 5
    query(1, 2) return false
    connect(1, 2)
    query(1, 3) return false
    connect(2, 4)
    query(1, 4) return true


    
    
  • 相关阅读:
    学完这 4 个小技巧,让你的移动端交互体验更加优秀
    Angular 项目搭建
    需求分析--分析需求
    需求分析--收集需求
    黑苹果+win 双系统 单硬盘安装
    小程序反编译
    计算机硬件基础(软考-网络中级)
    intellij idea 使用教程
    idea安装步骤
    volatile能保证有序性
  • 原文地址:https://www.cnblogs.com/lz87/p/7500092.html
Copyright © 2011-2022 走看看