yudake

工作与生活


  • 首页

  • 标签

  • 分类

  • 归档

  • 搜索

Search Insert Position

发表于 2019-12-23 | 分类于 每日一练

题目介绍

Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.

You may assume no duplicates in the array.

Example 1:

1
Input: [1,3,5,6], 5
2
Output: 2

Example 2:

1
Input: [1,3,5,6], 2
2
Output: 1

Example 3:

1
Input: [1,3,5,6], 7
2
Output: 4

Example 4:

1
Input: [1,3,5,6], 0
2
Output: 0
阅读全文 »

Find First and Last Position of Element in Sorted Array

发表于 2019-12-23 | 分类于 每日一练

题目介绍

Given an array of integers nums sorted in ascending order, find the starting and ending position of a given target value.

Your algorithm’s runtime complexity must be in the order of O(log n).

If the target is not found in the array, return [-1, -1].

Example 1:

1
Input: nums = [5,7,7,8,8,10], target = 8
2
Output: [3,4]

Example 2:

1
Input: nums = [5,7,7,8,8,10], target = 6
2
Output: [-1,-1]
阅读全文 »

Top-K Off-Policy Correction for a REINFORCE Recommender System

发表于 2019-12-23 | 分类于 强化学习

论文介绍

本篇论文是2018年Google发表的论文,应该是应用在YouTube的召回层。看其他人分享说是最近两年单次上线最高收益

论文链接:https://arxiv.org/pdf/1812.02353.pdf

论文背景

现在推荐系统的item在百万级别,user在十亿级别。在任意时间二者间产生的一个行为都是独一无二的。

这导致用户状态空间非常复杂。日志记录的隐式反馈很方便用于学习。

但是日志反馈的问题是:

  • 没被系统推出来的没有日志反馈,会有偏差

论文主要做了一下几个事:

  • 本篇论文提出了一种 Top-K 算法可以消除此偏差。此算法基于策略梯度,即REINFORCE(此算法给出了参考论文,笔者还未阅读)
  • 使用了一种非策略方案校准偏差

Remove Element

发表于 2019-12-19 | 分类于 每日一练

题目介绍

Given an array nums and a value val, remove all instances of that value in-place and return the new length.

Do not allocate extra space for another array, you must do this by modifying the input array in-place with O(1) extra memory.

The order of elements can be changed. It doesn’t matter what you leave beyond the new length.

阅读全文 »

Remove Duplicates from Sorted Array

发表于 2019-12-19 | 分类于 每日一练

题目介绍

Given a sorted array nums, remove the duplicates in-place such that each element appear only once and return the new length.

Do not allocate extra space for another array, you must do this by modifying the input array in-place with O(1) extra memory.

阅读全文 »

Reverse Nodes in k-Group

发表于 2019-12-17 | 分类于 每日一练

题目介绍

Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.

k is a positive integer and is less than or equal to the length of the linked list. If the number of nodes is not a multiple of k then left-out nodes in the end should remain as it is.

Example:

Given this linked list: 1->2->3->4->5

For k = 2, you should return: 2->1->4->3->5

For k = 3, you should return: 3->2->1->4->5

Note:

  • Only constant extra memory is allowed.
  • You may not alter the values in the list’s nodes, only nodes itself may be changed.
阅读全文 »

PyTorch入门

发表于 2019-12-17 | 分类于 PyTorch
之前一直使用TensorFlow,但是使用时间长了之后感觉不够灵活。据说PyTorch使用非常灵活,能够支持动态网络,Facebook和twitter都在使用。所以学一学使用方法,作为模型探索阶段的工具
阅读全文 »

Swap Nodes in Pairs

发表于 2019-12-16 | 分类于 每日一练

题目介绍

Given a linked list, swap every two adjacent nodes and return its head.

You may not modify the values in the list’s nodes, only nodes itself may be changed.

Example:

1
Given 1->2->3->4, you should return the list as 2->1->4->3.
阅读全文 »

Merge k Sorted Lists

发表于 2019-12-16 | 分类于 每日一练

题目介绍

Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.

Example:

1
Input:
2
[
3
  1->4->5,
4
  1->3->4,
5
  2->6
6
]
7
Output: 1->1->2->3->4->4->5->6
阅读全文 »

Generate Parentheses

发表于 2019-12-16 | 分类于 每日一练

题目介绍

Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.

For example, given n = 3, a solution set is:

1
[
2
  "((()))",
3
  "(()())",
4
  "(())()",
5
  "()(())",
6
  "()()()"
7
]
阅读全文 »

Merge Two Sorted Lists

发表于 2019-12-16 | 分类于 每日一练

题目介绍

Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.

Example:

1
Input: 1->2->4, 1->3->4
2
Output: 1->1->2->3->4->4
阅读全文 »

Valid Parentheses

发表于 2019-12-13 | 分类于 每日一练

题目介绍

Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.

An input string is valid if:

  1. Open brackets must be closed by the same type of brackets.
  2. Open brackets must be closed in the correct order.

Note that an empty string is also considered valid.

阅读全文 »
12<i class="fa fa-angle-right"></i>

yudake

如果能实现,我想带你去看绚丽的山岚,去看秀美的溪谷,这份心情该如何去形容呢 --夏目友人帐

15 日志
4 分类
5 标签
RSS
GitHub E-Mail
© 2019 yudake
由 Hexo 强力驱动
|
主题 — NexT.Gemini v5.1.4