/images/avatar.png

lc155.Min Stack

Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. Implement the MinStack class: MinStack() initializes the stack object. void push(int val) pushes the element val onto the stack. void pop() removes the element on the top of the stack. int top() gets the top element of the stack. int getMin() retrieves the minimum element in the stack. Example 1: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 Input ["MinStack","push","push","push","getMin","pop","top","getMin"] [[],[-2],[0],[-3],[],[],[],[]] Output [null,null,null,null,-3,null,0,-2] Explanation MinStack minStack = new MinStack(); minStack.

剑指 Offer 09. 用两个栈实现队列

用两个栈实现一个队列。队列的声明如下,请实现它的两个函数 appendTail 和 deleteHead ,分别完成在队列尾部插入整数和在队列头部删除整数的功能。(若队列中没有元素,deleteHead 操作返回 -1 ) 示例 1: 输入: 1 2 3 ["CQueue","appendTail","deleteHead","deleteHead"] [[],[3],[],[]] 输出:[null,null,3,-1] 示例 2: 输入: 1 2 3 ["CQueue","deleteHead","appendTail","appendTail","deleteHead","deleteHead"] [[],[],[5],[2],[],[]] 输出:[null,-1,null,null,5,2] 提示: 1 2 1 <= values <= 10000 最多会对 appendTail、deleteHead 进行 10000 次调用 来源:力扣(LeetCode) 链接:https://leetcode-cn.com/problems/yong-liang-ge-zhan-shi-xian-dui-lie-lcof 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。 解题思路 输入为两个栈, 第一个栈对应的是操作: [“CQueue”,“appendTail”,“deleteHead”,“deleteHead”] CQueue表示init一个CQueue object appendTail表示调用appendTail函数 deleteHead表示调用deleteHead函数 第二个栈对应的是操作的值。 栈(Stack)的特点是先入后出,但是我们需要实现直接操作Head的功能。因此使用两个Stack可以实现列表倒序。 1 2 3 4 5 6 7 8 9 10 11 12 13 class CQueue: def __init__(self): self.A, self.

[NMI] A geometric deep learning approach to predict binding conformations of bioactive molecules 解读

Title: A geometric deep learning approach to predict binding conformations of bioactive molecules DOI: https://doi.org/10.1038/s42256-021-00409-9 INFO: NATURE MACHINE INTELLIGENCE | VOL 3 | DECEMBER 2021 发表周期: Received: 18 May 2021; Accepted: 28 September 2021; Published online: 2 December 2021 药物设计是近年来AI应用的极火领域之一,其中一个最有挑战的问题就是空间结构设计。 One of the difficulties arises from the fact that only a small portion of the large chemical space will bind to a specific biological target and result in a therapeutic effect.