如何在本地机器上运行链表程序?当我在输入框中运行此代码时,它会运行,但我似乎无法在本地计算机中运行此程序。
function ListNode(val, next) {
this.val = (val===undefined ? 0 : val)
this.next = (next===undefined ? null : next)
}
/**
* @param {ListNode} list1
* @param {ListNode} list2
* @return {ListNode}
*/
var mergeTwoLists = function (l1, l2) {
var mergedHead = { val: -1, next: null },
crt = mergedHead;
while (l1 && l2) {
if (l1.val > l2.val) {
crt.next = l2;
l2 = l2.next;
} else {
crt.next = l1;
l1 = l1.next;
}
crt = …Run Code Online (Sandbox Code Playgroud) 我对这两个包感到困惑。我正在制作一个新的 Typescript 项目。
问题是,在我之前的项目中,我安装了react-router-dom和@types/react-router-dom来支持打字稿。
但现在react-router-domv6 出来了。
@types/react-router-dom包好像不再更新了。我还需要安装这个吗?没有它它会正常工作吗?
我现在将routecomponentprops历史记录传递给辅助函数。
这是主要组成部分
const FinishEmailSignup: React.FunctionComponent<RouteComponentProps> = ({ history }) => {
useEffect(( ) => {
testEmailAuth(history);
}, [history])
Run Code Online (Sandbox Code Playgroud)
现在这是我放置所有辅助函数的另一个组件。any我现在正在为道具提供类型history。type正确的history道具是什么
export function testEmailAuth ( history: any ) {
if (firebase.auth().isSignInWithEmailLink(window.location.href)) {
//Do Something
});
}
}
Run Code Online (Sandbox Code Playgroud) 我是科特林新手
据我了解,这段代码应该可以工作,但事实并非如此
fun main(args: Array<Int>) {
//printing out the first element of the array
println(args[0])
}
main([12,3,4,5])
Run Code Online (Sandbox Code Playgroud)