• [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


    
    
  • 相关阅读:
    ADB命令大全
    Backup your Android without root or custom recovery -- adb backup
    Content portal for Pocketables Tasker articles
    Is there a way to detect if call is in progress? Phone Event
    Tasker to proximity screen off
    Tasker to detect application running in background
    Tasker to create toggle widget for ES ftp service -- Send Intent
    Tasker to proximity screen on
    Tasker to answer incoming call by pressing power button
    Tasker to stop Poweramp control for the headset while there is an incoming SMS
  • 原文地址:https://www.cnblogs.com/lz87/p/7500092.html
Copyright © 2020-2023  润新知