小编win*_*ere的帖子

使用 Javascript 的二叉树级顺序遍历

这是一个leetcode问题。

给定一棵二叉树,返回其节点值的层序遍历。(即从左到右,逐级)。

例如:给定二叉树[3, 9, 20, null, null, 15, 7]

    3
   / \
  9  20
    /  \
   15   7
Run Code Online (Sandbox Code Playgroud)

返回其层序遍历为:

[
  [3],
  [9,20],
  [15,7]
]
Run Code Online (Sandbox Code Playgroud)

但我正在 JavaScript 中尝试一种新的方式,而不是完全按照他们的解决方案。到目前为止,我能够打印数组,但是

如何在新行中打印不同的级别

以下是我到目前为止的代码:

var levelOrder = function(root) {
let output = [];
let queue = [];
let currentNode = root;
queue.push(currentNode);
let currentLevel = 1;
while(queue.length){
    
    currentNode = queue.shift();
    currentLevel--; //this will ensure we are adding new lines only on next level
    output.push(currentNode);
    
    if(currentNode.left){
        queue.push(currentNode.left);
    }
    if(currentNode.right){
        queue.push(currentNode.right);
    }
    
    if(currentLevel = 0){ …
Run Code Online (Sandbox Code Playgroud)

javascript binary-tree breadth-first-search multidimensional-array

5
推荐指数
1
解决办法
1711
查看次数

在 Angular 的应用洞察中设置 cloud_RoleName

在asp.net的服务中,我们可以为应用程序洞察设置cloud_rolename。使用此功能,我们的服务团队可以跟踪应用程序洞察中的错误。我如何从角度设置它。这就是我以角度运行应用程序洞察的方式:

export class MonitoringService {
private appInsights: ApplicationInsights;
 constructor(private router: Router) {
  this.appInsights = new ApplicationInsights({
   config: {
     instrumentationKey: environment.appInsights.instrumentationKey,
  },
});
this.appInsights.loadAppInsights();
this.loadCustomTelemetryProperties();
this.createRouterSubscription();
Run Code Online (Sandbox Code Playgroud)

}

azure azure-application-insights angular

4
推荐指数
1
解决办法
553
查看次数

在解决方案资源管理器下的Visual Studio解决方案中创建的文件夹未出现在源代码管理资源管理器中

我将MVC解决方案转换为分层体系结构。为此,我在解决方案资源管理器的解决方案中添加了文件夹。一切正常,我的同事们能够使用最新的解决方案,并且文件夹出现在解决方案资源管理器中。

问题是我无法在TFS中查看文件夹结构(在Source Control Explorer中。)

也许我应该直接在TFS中创建文件夹结构。但是自从创建文件夹以来,我现在已经签入了很多更改,因此我认为此选项将不起作用。

请指教。

c# tfs layered visual-studio

2
推荐指数
1
解决办法
1447
查看次数

.net 核心的 ISO 8583 解析器

我需要将交易数据发送到 ISO 8583 中的 TCP 端口。OpenISO8583.net 是适用于 .net 框架和 Jpos for Java 的绝佳工具。

我需要在 .net 核心中构建它。在 .net 核心项目中安装 OpenISO8583.net 库时,我收到警告。我在网上做了很多挖掘,但没有找到适合 ISO 8583 支持的 .net 核心库。请建议。

包“OpenIso8583.Net 0.5.2”使用“.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, ”恢复。 NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' 而不是项目目标框架 '.NETCoreApp,Version=v3.1'。此包可能与您的项目不完全兼容。

OpenISO8583.net

.net c# iso8583 asp.net-core

-1
推荐指数
1
解决办法
163
查看次数