加载中...
import java.util.*; public class Solution { /** * * @param prices int整型一维数组 * @return int整型 */ public int maxProfit (int[] prices) { // write code here } }
class Solution { public: /** * * @param prices int整型vector * @return int整型 */ int maxProfit(vector
& prices) { // write code here } };
# # # @param prices int整型一维数组 # @return int整型 # class Solution: def maxProfit(self , prices ): # write code here
using System; using System.Collections.Generic; class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param prices int整型一维数组 * @return int整型 */ public int maxProfit (List
prices) { // write code here } }
/** * * @param prices int整型一维数组 * @return int整型 */ function maxProfit( prices ) { // write code here } module.exports = { maxProfit : maxProfit };
# # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # # @param prices int整型一维数组 # @return int整型 # class Solution: def maxProfit(self , prices: List[int]) -> int: # write code here
package main /** * * @param prices int整型一维数组 * @return int整型 */ func maxProfit( prices []int ) int { // write code here }
/** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param prices int整型一维数组 * @param pricesLen int prices数组长度 * @return int整型 */ int maxProfit(int* prices, int pricesLen ) { // write code here }
# # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # @param prices int整型一维数组 # @return int整型 # class Solution def maxProfit(prices) # write code here end end
object Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * @param prices int整型一维数组 * @return int整型 */ def maxProfit(prices: Array[Int]): Int = { // write code here } }
object Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * @param prices int整型一维数组 * @return int整型 */ fun maxProfit(prices: IntArray): Int { // write code here } }
import java.util.*; public class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * @param prices int整型一维数组 * @return int整型 */ public int maxProfit (int[] prices) { // write code here } }
/** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * @param prices int整型一维数组 * @return int整型 */ export function maxProfit(prices: number[]): number { // write code here }
public class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * @param prices int整型一维数组 * @return int整型 */ func maxProfit ( _ prices: [Int]) -> Int { // write code here } }
struct Solution{ } impl Solution { fn new() -> Self { Solution{} } /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * @param prices int整型一维数组 * @return int整型 */ pub fn maxProfit(&self, prices: Vec
) -> i32 { // write code here } }
[8,9,2,5,4,7,1]
5
[2,4,1]
2
[3,2,1]
0